From 3078dd3c1053da106a1c510fe3fca7c3d44d16e6 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 19 May 2010 03:44:15 +0000 Subject: [PATCH] sync with trunk (r47268) svn path=/branches/reactos-yarotows/; revision=47271 --- ReactOS-arm.rbuild | 3 + base/applications/rapps/rapps/dosbox.txt | 4 +- base/applications/rapps/rapps/firefox2.txt | 12 +- base/applications/rapps/rapps/irfanview.txt | 4 +- .../rapps/rapps/irfanviewplugins.txt | 6 +- base/applications/rapps/rapps/rosbe.txt | 4 +- base/applications/rapps/rapps/utorrent.txt | 6 +- base/applications/regedit/find.c | 627 ++++++++++++++++-- base/applications/regedit/lang/bg-BG.rc | 2 +- base/applications/regedit/lang/cs-CZ.rc | 2 +- base/applications/regedit/lang/de-DE.rc | 2 +- base/applications/regedit/lang/el-GR.rc | 2 +- base/applications/regedit/lang/en-US.rc | 2 +- base/applications/regedit/lang/es-ES.rc | 2 +- base/applications/regedit/lang/fr-FR.rc | 2 +- base/applications/regedit/lang/hu-HU.rc | 2 +- base/applications/regedit/lang/id-ID.rc | 2 +- base/applications/regedit/lang/it-IT.rc | 2 +- base/applications/regedit/lang/ja-JP.rc | 6 +- base/applications/regedit/lang/ko-KR.rc | 2 +- base/applications/regedit/lang/nl-NL.rc | 2 +- base/applications/regedit/lang/no-NO.rc | 2 +- base/applications/regedit/lang/pl-PL.rc | 2 +- base/applications/regedit/lang/pt-BR.rc | 2 +- base/applications/regedit/lang/pt-PT.rc | 2 +- base/applications/regedit/lang/ru-RU.rc | 2 +- base/applications/regedit/lang/sk-SK.rc | 2 +- base/applications/regedit/lang/sl-SI.rc | 2 +- base/applications/regedit/lang/sv-SE.rc | 2 +- base/applications/regedit/lang/th-TH.rc | 2 +- base/applications/regedit/lang/uk-UA.rc | 2 +- base/applications/regedit/lang/zh-CN.rc | 2 +- base/applications/regedit/listview.c | 35 +- base/applications/regedit/regproc.c | 141 ---- base/applications/regedit/regproc.h | 4 - boot/bootdata/hivesft_arm.inf | 4 + boot/bootdata/hivesft_i386.inf | 4 + boot/bootdata/hivesys_i386.inf | 4 + dll/win32/kernel32/mem/global.c | 209 +++--- dll/win32/kernel32/misc/console.c | 4 +- dll/win32/kernel32/misc/nls.c | 343 +++++++++- dll/win32/kernel32/misc/utils.c | 2 +- dll/win32/kernel32/thread/fiber.c | 9 +- dll/win32/kernel32/thread/i386/fiber.S | 12 +- dll/win32/qmgr/qmgr.inf | 2 +- dll/win32/setupapi/install.c | 2 +- dll/win32/user32/windows/menu.c | 4 +- dll/win32/user32/windows/window.c | 30 + dll/win32/userenv/lang/de-DE.rc | 2 +- dll/win32/userenv/lang/fr-FR.rc | 2 +- drivers/network/afd/afd/read.c | 2 +- hal/halx86/hal_generic.rbuild | 12 +- hal/halx86/halamd64.rbuild | 2 +- include/ndk/i386/asm.h | 1 + subsystems/win32/csrss/win32csr/conio.c | 9 +- subsystems/win32/win32k/include/rect.h | 4 + subsystems/win32/win32k/ntuser/menu.c | 19 +- subsystems/win32/win32k/ntuser/timer.c | 7 +- subsystems/win32/win32k/ntuser/window.c | 18 +- subsystems/win32/win32k/ntuser/winpos.c | 128 +++- subsystems/win32/win32k/objects/rect.c | 9 + 61 files changed, 1323 insertions(+), 419 deletions(-) diff --git a/ReactOS-arm.rbuild b/ReactOS-arm.rbuild index 6d7abe77d6e..29bddc97feb 100644 --- a/ReactOS-arm.rbuild +++ b/ReactOS-arm.rbuild @@ -74,6 +74,9 @@ + + + diff --git a/base/applications/rapps/rapps/dosbox.txt b/base/applications/rapps/rapps/dosbox.txt index 783779deeed..7a25f08dcb9 100644 --- a/base/applications/rapps/rapps/dosbox.txt +++ b/base/applications/rapps/rapps/dosbox.txt @@ -2,13 +2,13 @@ [Section] Name = DOSBox -Version = 0.73 +Version = 0.74 Licence = GPL Description = DOSBox is a DOS emulator. Size = 1.4MB Category = 15 URLSite = http://www.dosbox.com/ -URLDownload = http://ovh.dl.sourceforge.net/sourceforge/dosbox/DOSBox0.73-win32-installer.exe +URLDownload = http://ovh.dl.sourceforge.net/sourceforge/dosbox/DOSBox0.74-win32-installer.exe CDPath = none [Section.0407] diff --git a/base/applications/rapps/rapps/firefox2.txt b/base/applications/rapps/rapps/firefox2.txt index 0c6379485c7..3cf7dc27921 100644 --- a/base/applications/rapps/rapps/firefox2.txt +++ b/base/applications/rapps/rapps/firefox2.txt @@ -8,35 +8,35 @@ Description = The most popular and one of the best free Web Browsers out there. Size = 5.8M Category = 5 URLSite = http://www.mozilla.com/en-US/ -URLDownload = http://mozilla.mirrors.easynews.com/mozilla/firefox/releases/2.0.0.20/win32/en-US/Firefox%20Setup%202.0.0.20.exe +URLDownload = http://194.71.11.70/pub/www/clients/mozilla.org/firefox/releases/2.0.0.20/win32/en-US/Firefox%20Setup%202.0.0.20.exe CDPath = none [Section.0407] Description = Der populärste und einer der besten freien Webbrowser. Size = 5.5M URLSite = http://www.mozilla-europe.org/de/ -URLDownload = http://mozilla.mirrors.easynews.com/mozilla/firefox/releases/2.0.0.20/win32/de/Firefox%20Setup%202.0.0.20.exe +URLDownload = http://194.71.11.70/pub/www/clients/mozilla.org/firefox/releases/2.0.0.20/win32/de/Firefox%20Setup%202.0.0.20.exe [Section.040a] Description = El más popular y uno de los mejores navegadores web gratuitos que hay. Size = 5.6M URLSite = http://www.mozilla-europe.org/es/ -URLDownload = http://mozilla.mirrors.easynews.com/mozilla/firefox/releases/2.0.0.20/win32/es-ES/Firefox%20Setup%202.0.0.20.exe +URLDownload = http://194.71.11.70/pub/www/clients/mozilla.org/firefox/releases/2.0.0.20/win32/es-ES/Firefox%20Setup%202.0.0.20.exe [Section.0414] Description = Mest populære og best også gratis nettleserene der ute. Size = 5.6M URLSite = http://www.mozilla-europe.org/no/ -URLDownload = http://mozilla.mirrors.easynews.com/mozilla/firefox/releases/2.0.0.20/win32/nb-NO/Firefox%20Setup%202.0.0.20.exe +URLDownload = http://194.71.11.70/pub/www/clients/mozilla.org/firefox/releases/2.0.0.20/win32/nb-NO/Firefox%20Setup%202.0.0.20.exe [Section.0415] Description = Najpopularniejsza i jedna z najlepszych darmowych przeglądarek internetowych. Size = 6.3M URLSite = http://www.mozilla-europe.org/pl/ -URLDownload = http://mozilla.mirrors.easynews.com/mozilla/firefox/releases/2.0.0.20/win32/pl/Firefox%20Setup%202.0.0.20.exe +URLDownload = http://194.71.11.70/pub/www/clients/mozilla.org/firefox/releases/2.0.0.20/win32/pl/Firefox%20Setup%202.0.0.20.exe [Section.0419] Description = Один из самых популярных и лучших бесплатных браузеров. Size = 6.4M URLSite = http://www.mozilla-europe.org/ru/ -URLDownload = http://mozilla.mirrors.easynews.com/mozilla/firefox/releases/2.0.0.20/win32/ru/Firefox%20Setup%202.0.0.20.exe +URLDownload = http://194.71.11.70/pub/www/clients/mozilla.org/firefox/releases/2.0.0.20/win32/ru/Firefox%20Setup%202.0.0.20.exe diff --git a/base/applications/rapps/rapps/irfanview.txt b/base/applications/rapps/rapps/irfanview.txt index 9f1d5743f68..c392d1eea3e 100644 --- a/base/applications/rapps/rapps/irfanview.txt +++ b/base/applications/rapps/rapps/irfanview.txt @@ -2,13 +2,13 @@ [Section] Name = IrfanView -Version = 4.25 +Version = 4.27 Licence = Freeware (for personal use) Description = Viewer for all kinds of graphics/audio files/video files. Size = 1.3MB Category = 3 URLSite = http://www.irfanview.com/ -URLDownload = http://irfanview.tuwien.ac.at/iview425_setup.exe +URLDownload = http://irfanview.tuwien.ac.at/iview427_setup.exe CDPath = none [Section.0407] diff --git a/base/applications/rapps/rapps/irfanviewplugins.txt b/base/applications/rapps/rapps/irfanviewplugins.txt index 9d36ab8faa8..fc7ab238b6e 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.25 +Version = 4.27 Licence = Freeware (for personal use) Description = Additional Plugins for supporting more file types. -Size = 7.7MB +Size = 7.8MB Category = 3 URLSite = http://www.irfanview.com/ -URLDownload = http://irfanview.tuwien.ac.at/plugins/irfanview_plugins_425_setup.exe +URLDownload = http://irfanview.tuwien.ac.at/plugins/irfanview_plugins_427_setup.exe CDPath = none [Section.0407] diff --git a/base/applications/rapps/rapps/rosbe.txt b/base/applications/rapps/rapps/rosbe.txt index 7d7918b5c78..384df84563a 100644 --- a/base/applications/rapps/rapps/rosbe.txt +++ b/base/applications/rapps/rapps/rosbe.txt @@ -2,13 +2,13 @@ [Section] Name = ReactOS Build Environment -Version = 1.5 +Version = 1.5.1 Licence = GPL Description = Allows you to build the ReactOS Source. For more instructions see ReactOS wiki. Size = 13.5MB Category = 7 URLSite = http://reactos.org/wiki/Build_Environment/ -URLDownload = http://ovh.dl.sourceforge.net/sourceforge/reactos/RosBE-1.5.exe +URLDownload = http://ovh.dl.sourceforge.net/sourceforge/reactos/RosBE-1.5.1.exe CDPath = none [Section.0407] diff --git a/base/applications/rapps/rapps/utorrent.txt b/base/applications/rapps/rapps/utorrent.txt index ffcded74c34..f987811b5a8 100644 --- a/base/applications/rapps/rapps/utorrent.txt +++ b/base/applications/rapps/rapps/utorrent.txt @@ -2,13 +2,13 @@ [Section] Name = µTorrent -Version = 2.0.1 +Version = 2.0.2 Licence = Freeware for non-commercial uses Description = Small and fast BitTorrent Client. -Size = 314K +Size = 315K Category = 5 URLSite = http://www.utorrent.com/ -URLDownload = http://download.utorrent.com/2.0.1/utorrent.exe +URLDownload = http://download.utorrent.com/2.0.2/utorrent.exe CDPath = none diff --git a/base/applications/regedit/find.c b/base/applications/regedit/find.c index d718007adb5..e20d01684f8 100644 --- a/base/applications/regedit/find.c +++ b/base/applications/regedit/find.c @@ -25,13 +25,531 @@ static const TCHAR s_szFindFlagsR[] = _T("FindFlagsReactOS"); static HWND s_hwndAbortDialog; static BOOL s_bAbort; +static DWORD s_dwFlags; +static TCHAR s_szName[MAX_PATH]; +static DWORD s_cbName; +static const TCHAR s_empty[] = {0}; +static const TCHAR s_backslash[] = {'\\', 0}; + +extern VOID SetValueName(HWND hwndLV, LPCTSTR pszValueName); + +BOOL DoEvents(VOID) +{ + MSG msg; + if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + if (msg.message == WM_QUIT) + s_bAbort = TRUE; + if (!IsDialogMessage(s_hwndAbortDialog, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + return s_bAbort; +} + +static LPTSTR lstrstri(LPCTSTR psz1, LPCTSTR psz2) +{ + INT i, cch1, cch2; + + cch1 = lstrlen(psz1); + cch2 = lstrlen(psz2); + for(i = 0; i <= cch1 - cch2; i++) + { + if (CompareString(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, + psz1 + i, cch2, psz2, cch2) == 2) + return (LPTSTR) (psz1 + i); + } + return NULL; +} + +static BOOL CompareName(LPCTSTR pszName1, LPCTSTR pszName2) +{ + if (s_dwFlags & RSF_WHOLESTRING) + { + if (s_dwFlags & RSF_MATCHCASE) + return lstrcmp(pszName1, pszName2) == 0; + else + return lstrcmpi(pszName1, pszName2) == 0; + } + else + { + if (s_dwFlags & RSF_MATCHCASE) + return _tcsstr(pszName1, pszName2) != NULL; + else + return lstrstri(pszName1, pszName2) != NULL; + } +} + +static BOOL +CompareData( + DWORD dwType, + LPCTSTR psz1, + LPCTSTR psz2) +{ + INT i, cch1 = lstrlen(psz1), cch2 = lstrlen(psz2); + if (dwType == REG_SZ || dwType == REG_EXPAND_SZ) + { + if (s_dwFlags & RSF_WHOLESTRING) + { + if (s_dwFlags & RSF_MATCHCASE) + return 2 == CompareString(LOCALE_SYSTEM_DEFAULT, 0, + psz1, cch1, psz2, cch2); + else + return 2 == CompareString(LOCALE_SYSTEM_DEFAULT, + NORM_IGNORECASE, psz1, cch1, psz2, cch2); + } + + for(i = 0; i <= cch1 - cch2; i++) + { + if (s_dwFlags & RSF_MATCHCASE) + { + if (2 == CompareString(LOCALE_SYSTEM_DEFAULT, 0, + psz1 + i, cch2, psz2, cch2)) + return TRUE; + } + else + { + if (2 == CompareString(LOCALE_SYSTEM_DEFAULT, + NORM_IGNORECASE, psz1 + i, cch2, psz2, cch2)) + return TRUE; + } + } + } + return FALSE; +} + +int compare(const void *x, const void *y) +{ + const LPCTSTR *a = (const LPCTSTR *)x; + const LPCTSTR *b = (const LPCTSTR *)y; + return lstrcmpi(*a, *b); +} + +BOOL RegFindRecurse( + HKEY hKey, + LPCTSTR pszSubKey, + LPCTSTR pszValueName, + LPTSTR *ppszFoundSubKey, + LPTSTR *ppszFoundValueName) +{ + HKEY hSubKey; + LONG lResult; + TCHAR szSubKey[MAX_PATH]; + DWORD i, c, cb, type; + BOOL fPast = FALSE; + LPTSTR *ppszNames = NULL; + LPBYTE pb = NULL; + + if (DoEvents()) + return FALSE; + + lstrcpy(szSubKey, pszSubKey); + hSubKey = NULL; + + lResult = RegOpenKeyEx(hKey, szSubKey, 0, KEY_ALL_ACCESS, &hSubKey); + if (lResult != ERROR_SUCCESS) + return FALSE; + + if (pszValueName == NULL) + pszValueName = s_empty; + + lResult = RegQueryInfoKey(hSubKey, NULL, NULL, NULL, NULL, NULL, NULL, + &c, NULL, NULL, NULL, NULL); + if (lResult != ERROR_SUCCESS) + goto err; + ppszNames = (LPTSTR *) malloc(c * sizeof(LPTSTR)); + if (ppszNames == NULL) + goto err; + ZeroMemory(ppszNames, c * sizeof(LPTSTR)); + + for(i = 0; i < c; i++) + { + if (DoEvents()) + goto err; + + s_cbName = MAX_PATH * sizeof(TCHAR); + lResult = RegEnumValue(hSubKey, i, s_szName, &s_cbName, NULL, NULL, + NULL, &cb); + if (lResult == ERROR_NO_MORE_ITEMS) + { + c = i; + break; + } + if (lResult != ERROR_SUCCESS) + goto err; + if (s_cbName >= MAX_PATH * sizeof(TCHAR)) + continue; + + ppszNames[i] = _tcsdup(s_szName); + } + + qsort(ppszNames, c, sizeof(LPTSTR), compare); + + for(i = 0; i < c; i++) + { + if (DoEvents()) + goto err; + + if (!fPast && lstrcmpi(ppszNames[i], pszValueName) == 0) + { + fPast = TRUE; + continue; + } + if (!fPast) + continue; + + if ((s_dwFlags & RSF_LOOKATVALUES) && + CompareName(ppszNames[i], s_szFindWhat)) + { + *ppszFoundSubKey = _tcsdup(szSubKey); + if (ppszNames[i][0] == 0) + *ppszFoundValueName = NULL; + else + *ppszFoundValueName = _tcsdup(ppszNames[i]); + goto success; + } + + lResult = RegQueryValueEx(hSubKey, ppszNames[i], NULL, &type, + NULL, &cb); + if (lResult != ERROR_SUCCESS) + goto err; + pb = malloc(cb); + if (pb == NULL) + goto err; + lResult = RegQueryValueEx(hSubKey, ppszNames[i], NULL, &type, + pb, &cb); + if (lResult != ERROR_SUCCESS) + goto err; + + if ((s_dwFlags & RSF_LOOKATDATA) && + CompareData(type, (LPTSTR) pb, s_szFindWhat)) + { + *ppszFoundSubKey = _tcsdup(szSubKey); + if (ppszNames[i][0] == 0) + *ppszFoundValueName = NULL; + else + *ppszFoundValueName = _tcsdup(ppszNames[i]); + goto success; + } + free(pb); + pb = NULL; + } + + if (ppszNames != NULL) + { + for(i = 0; i < c; i++) + free(ppszNames[i]); + free(ppszNames); + } + ppszNames = NULL; + + lResult = RegQueryInfoKey(hSubKey, NULL, NULL, NULL, &c, NULL, NULL, + NULL, NULL, NULL, NULL, NULL); + if (lResult != ERROR_SUCCESS) + goto err; + ppszNames = (LPTSTR *) malloc(c * sizeof(LPTSTR)); + if (ppszNames == NULL) + goto err; + ZeroMemory(ppszNames, c * sizeof(LPTSTR)); + + for(i = 0; i < c; i++) + { + if (DoEvents()) + goto err; + + s_cbName = MAX_PATH * sizeof(TCHAR); + lResult = RegEnumKeyEx(hSubKey, i, s_szName, &s_cbName, NULL, NULL, + NULL, NULL); + if (lResult == ERROR_NO_MORE_ITEMS) + { + c = i; + break; + } + if (lResult != ERROR_SUCCESS) + goto err; + if (s_cbName >= MAX_PATH * sizeof(TCHAR)) + continue; + + ppszNames[i] = _tcsdup(s_szName); + } + + qsort(ppszNames, c, sizeof(LPTSTR), compare); + + for(i = 0; i < c; i++) + { + if (DoEvents()) + goto err; + + if ((s_dwFlags & RSF_LOOKATKEYS) && + CompareName(ppszNames[i], s_szFindWhat)) + { + *ppszFoundSubKey = malloc( + (lstrlen(szSubKey) + lstrlen(ppszNames[i]) + 2) * + sizeof(TCHAR)); + if (*ppszFoundSubKey == NULL) + goto err; + if (szSubKey[0]) + { + lstrcpy(*ppszFoundSubKey, szSubKey); + lstrcatW(*ppszFoundSubKey, s_backslash); + } + else + **ppszFoundSubKey = 0; + lstrcatW(*ppszFoundSubKey, ppszNames[i]); + *ppszFoundValueName = NULL; + goto success; + } + + if (RegFindRecurse(hSubKey, ppszNames[i], NULL, ppszFoundSubKey, + ppszFoundValueName)) + { + LPTSTR psz = *ppszFoundSubKey; + *ppszFoundSubKey = malloc( + (lstrlen(szSubKey) + lstrlen(psz) + 2) * sizeof(TCHAR)); + if (*ppszFoundSubKey == NULL) + goto err; + if (szSubKey[0]) + { + lstrcpy(*ppszFoundSubKey, szSubKey); + lstrcatW(*ppszFoundSubKey, s_backslash); + } + else + **ppszFoundSubKey = 0; + lstrcatW(*ppszFoundSubKey, psz); + free(psz); + goto success; + } + } + +err: + if (ppszNames != NULL) + { + for(i = 0; i < c; i++) + free(ppszNames[i]); + free(ppszNames); + } + free(pb); + RegCloseKey(hSubKey); + return FALSE; + +success: + if (ppszNames != NULL) + { + for(i = 0; i < c; i++) + free(ppszNames[i]); + free(ppszNames); + } + RegCloseKey(hSubKey); + return TRUE; +} + +BOOL RegFindWalk( + HKEY * phKey, + LPCTSTR pszSubKey, + LPCTSTR pszValueName, + LPTSTR *ppszFoundSubKey, + LPTSTR *ppszFoundValueName) +{ + LONG lResult; + DWORD i, c; + HKEY hBaseKey, hSubKey; + TCHAR szKeyName[MAX_PATH]; + TCHAR szSubKey[MAX_PATH]; + LPTSTR pch; + BOOL fPast; + LPTSTR *ppszNames = NULL; + + hBaseKey = *phKey; + if (RegFindRecurse(hBaseKey, pszSubKey, pszValueName, ppszFoundSubKey, + ppszFoundValueName)) + return TRUE; + + if (lstrlen(pszSubKey) >= MAX_PATH) + return FALSE; + + lstrcpy(szSubKey, pszSubKey); + while(szSubKey[0] != 0) + { + if (DoEvents()) + return FALSE; + + pch = _tcsrchr(szSubKey, _T('\\')); + if (pch == NULL) + { + lstrcpy(szKeyName, szSubKey); + szSubKey[0] = 0; + hSubKey = hBaseKey; + } + else + { + lstrcpyn(szKeyName, pch + 1, MAX_PATH); + *pch = 0; + lResult = RegOpenKeyEx(hBaseKey, szSubKey, 0, KEY_ALL_ACCESS, + &hSubKey); + if (lResult != ERROR_SUCCESS) + return FALSE; + } + + lResult = RegQueryInfoKey(hSubKey, NULL, NULL, NULL, &c, NULL, NULL, + NULL, NULL, NULL, NULL, NULL); + if (lResult != ERROR_SUCCESS) + goto err; + + ppszNames = (LPTSTR *) malloc(c * sizeof(LPTSTR)); + if (ppszNames == NULL) + goto err; + ZeroMemory(ppszNames, c * sizeof(LPTSTR)); + + for(i = 0; i < c; i++) + { + if (DoEvents()) + goto err; + + s_cbName = MAX_PATH * sizeof(TCHAR); + lResult = RegEnumKeyExW(hSubKey, i, s_szName, &s_cbName, + NULL, NULL, NULL, NULL); + if (lResult == ERROR_NO_MORE_ITEMS) + { + c = i; + break; + } + if (lResult != ERROR_SUCCESS) + break; + ppszNames[i] = _tcsdup(s_szName); + } + + qsort(ppszNames, c, sizeof(LPTSTR), compare); + + fPast = FALSE; + for(i = 0; i < c; i++) + { + if (DoEvents()) + goto err; + + if (!fPast && lstrcmpi(ppszNames[i], szKeyName) == 0) + { + fPast = TRUE; + continue; + } + if (!fPast) + continue; + + if ((s_dwFlags & RSF_LOOKATKEYS) && + CompareName(ppszNames[i], s_szFindWhat)) + { + *ppszFoundSubKey = malloc( + (lstrlen(szSubKey) + lstrlen(ppszNames[i]) + 2) * + sizeof(TCHAR)); + if (*ppszFoundSubKey == NULL) + goto err; + if (szSubKey[0]) + { + lstrcpy(*ppszFoundSubKey, szSubKey); + lstrcatW(*ppszFoundSubKey, s_backslash); + } + else + **ppszFoundSubKey = 0; + lstrcatW(*ppszFoundSubKey, ppszNames[i]); + *ppszFoundValueName = NULL; + goto success; + } + + if (RegFindRecurse(hSubKey, ppszNames[i], NULL, + ppszFoundSubKey, ppszFoundValueName)) + { + LPTSTR psz = *ppszFoundSubKey; + *ppszFoundSubKey = malloc( + (lstrlen(szSubKey) + lstrlen(psz) + 2) * + sizeof(TCHAR)); + if (*ppszFoundSubKey == NULL) + goto err; + if (szSubKey[0]) + { + lstrcpy(*ppszFoundSubKey, szSubKey); + lstrcatW(*ppszFoundSubKey, s_backslash); + } + else + **ppszFoundSubKey = 0; + lstrcatW(*ppszFoundSubKey, psz); + free(psz); + goto success; + } + } + if (ppszNames != NULL) + { + for(i = 0; i < c; i++) + free(ppszNames[i]); + free(ppszNames); + } + ppszNames = NULL; + + if (hBaseKey != hSubKey) + RegCloseKey(hSubKey); + } + + if (*phKey == HKEY_CLASSES_ROOT) + { + *phKey = HKEY_CURRENT_USER; + if (RegFindRecurse(*phKey, s_empty, NULL, ppszFoundSubKey, + ppszFoundValueName)) + return TRUE; + } + + if (*phKey == HKEY_CURRENT_USER) + { + *phKey = HKEY_LOCAL_MACHINE; + if (RegFindRecurse(*phKey, s_empty, NULL, ppszFoundSubKey, + ppszFoundValueName)) + goto success; + } + + if (*phKey == HKEY_LOCAL_MACHINE) + { + *phKey = HKEY_USERS; + if (RegFindRecurse(*phKey, s_empty, NULL, ppszFoundSubKey, + ppszFoundValueName)) + goto success; + } + + if (*phKey == HKEY_USERS) + { + *phKey = HKEY_CURRENT_CONFIG; + if (RegFindRecurse(*phKey, s_empty, NULL, ppszFoundSubKey, + ppszFoundValueName)) + goto success; + } + +err: + if (ppszNames != NULL) + { + for(i = 0; i < c; i++) + free(ppszNames[i]); + free(ppszNames); + } + if (hBaseKey != hSubKey) + RegCloseKey(hSubKey); + return FALSE; + +success: + if (ppszNames != NULL) + { + for(i = 0; i < c; i++) + free(ppszNames[i]); + free(ppszNames); + } + if (hBaseKey != hSubKey) + RegCloseKey(hSubKey); + return TRUE; +} static DWORD GetFindFlags(void) { HKEY hKey; - DWORD dwFlags = RSF_LOOKATKEYS; DWORD dwType, dwValue, cbData; + DWORD dwFlags = RSF_LOOKATKEYS | RSF_LOOKATVALUES | RSF_LOOKATDATA; if (RegOpenKey(HKEY_CURRENT_USER, g_szGeneralRegKey, &hKey) == ERROR_SUCCESS) { @@ -102,45 +620,54 @@ static INT_PTR CALLBACK AbortFindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, return 0; } -static BOOL RegSearchProc(LPVOID lpParam) -{ - MSG msg; - UNREFERENCED_PARAMETER(lpParam); - - if (s_hwndAbortDialog && PeekMessage(&msg, s_hwndAbortDialog, 0, 0, PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - return s_bAbort; -} - BOOL FindNext(HWND hWnd) { HKEY hKeyRoot; - LPCTSTR pszFindWhat; LPCTSTR pszKeyPath; - DWORD dwFlags; - LONG lResult; - TCHAR szSubKey[512]; - TCHAR szError[512]; - TCHAR szTitle[64]; + BOOL fSuccess; TCHAR szFullKey[512]; + LPCTSTR pszValueName; + LPTSTR pszFoundSubKey, pszFoundValueName; - pszFindWhat = s_szFindWhat; - dwFlags = GetFindFlags() & ~(RSF_LOOKATVALUES | RSF_LOOKATDATA); + if (_tcslen(s_szFindWhat) == 0) + { + FindDialog(hWnd); + return TRUE; + } + + s_dwFlags = GetFindFlags(); pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot); - lstrcpyn(szSubKey, pszKeyPath, sizeof(szSubKey) / sizeof(szSubKey[0])); + if (pszKeyPath == NULL) + { + hKeyRoot = HKEY_CLASSES_ROOT; + pszKeyPath = s_empty; + } /* Create abort find dialog */ - s_hwndAbortDialog = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_FINDING), hWnd, AbortFindDialogProc); + s_hwndAbortDialog = CreateDialog(GetModuleHandle(NULL), + MAKEINTRESOURCE(IDD_FINDING), hWnd, AbortFindDialogProc); if (s_hwndAbortDialog) + { ShowWindow(s_hwndAbortDialog, SW_SHOW); + UpdateWindow(s_hwndAbortDialog); + } s_bAbort = FALSE; - lResult = RegSearch(hKeyRoot, szSubKey, sizeof(szSubKey) / sizeof(szSubKey[0]), - pszFindWhat, 0, dwFlags, RegSearchProc, NULL); + pszValueName = GetValueName(g_pChildWnd->hListWnd, -1); + + EnableWindow(hFrameWnd, FALSE); + EnableWindow(g_pChildWnd->hTreeWnd, FALSE); + EnableWindow(g_pChildWnd->hListWnd, FALSE); + EnableWindow(g_pChildWnd->hAddressBarWnd, FALSE); + + fSuccess = RegFindWalk(&hKeyRoot, pszKeyPath, pszValueName, + &pszFoundSubKey, &pszFoundValueName); + + EnableWindow(hFrameWnd, TRUE); + EnableWindow(g_pChildWnd->hTreeWnd, TRUE); + EnableWindow(g_pChildWnd->hListWnd, TRUE); + EnableWindow(g_pChildWnd->hAddressBarWnd, TRUE); if (s_hwndAbortDialog) { @@ -148,26 +675,16 @@ BOOL FindNext(HWND hWnd) s_hwndAbortDialog = NULL; } - /* Did the user click "Cancel"? If so, exit without displaying an error message */ - if (lResult == ERROR_OPERATION_ABORTED) - return FALSE; - - if (lResult != ERROR_SUCCESS) + if (fSuccess) { - LoadString(NULL, IDS_APP_TITLE, szTitle, sizeof(szTitle) / sizeof(szTitle[0])); - - if ((lResult != ERROR_NO_MORE_ITEMS) || !LoadString(NULL, IDS_FINISHEDFIND, szError, sizeof(szError) / sizeof(szError[0]))) - { - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, lResult, 0, - szError, sizeof(szError) / sizeof(szError[0]), NULL); - } - MessageBox(hWnd, szError, szTitle, MB_OK); - return FALSE; + RegKeyGetName(szFullKey, COUNT_OF(szFullKey), hKeyRoot, pszFoundSubKey); + SelectNode(g_pChildWnd->hTreeWnd, szFullKey); + SetValueName(g_pChildWnd->hListWnd, pszFoundValueName); + free(pszFoundSubKey); + free(pszFoundValueName); + SetFocus(g_pChildWnd->hListWnd); } - - RegKeyGetName(szFullKey, sizeof(szFullKey) / sizeof(szFullKey[0]), hKeyRoot, szSubKey); - SelectNode(g_pChildWnd->hTreeWnd, szFullKey); - return TRUE; + return fSuccess; } static INT_PTR CALLBACK FindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -183,26 +700,17 @@ static INT_PTR CALLBACK FindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR case WM_INITDIALOG: dwFlags = GetFindFlags(); - /* Looking at values is not yet implemented */ hControl = GetDlgItem(hDlg, IDC_LOOKAT_KEYS); if (hControl) SendMessage(hControl, BM_SETCHECK, (dwFlags & RSF_LOOKATKEYS) ? TRUE : FALSE, 0); - /* Looking at values is not yet implemented */ hControl = GetDlgItem(hDlg, IDC_LOOKAT_VALUES); if (hControl) - { - lStyle = GetWindowLongPtr(hControl, GWL_STYLE); - SetWindowLongPtr(hControl, GWL_STYLE, lStyle | WS_DISABLED); - } + SendMessage(hControl, BM_SETCHECK, (dwFlags & RSF_LOOKATVALUES) ? TRUE : FALSE, 0); - /* Looking at data is not yet implemented */ hControl = GetDlgItem(hDlg, IDC_LOOKAT_DATA); if (hControl) - { - lStyle = GetWindowLongPtr(hControl, GWL_STYLE); - SetWindowLongPtr(hControl, GWL_STYLE, lStyle | WS_DISABLED); - } + SendMessage(hControl, BM_SETCHECK, (dwFlags & RSF_LOOKATDATA) ? TRUE : FALSE, 0); /* Match whole string */ hControl = GetDlgItem(hDlg, IDC_MATCHSTRING); @@ -299,7 +807,14 @@ void FindDialog(HWND hWnd) if (DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_FIND), hWnd, FindDialogProc, 0) != 0) { - FindNext(hWnd); + if (FindNext(hWnd) == FALSE) + { + TCHAR msg[128], caption[128]; + + LoadString(hInst, IDS_FINISHEDFIND, msg, sizeof(msg)/sizeof(TCHAR)); + LoadString(hInst, IDS_APP_TITLE, caption, sizeof(caption)/sizeof(TCHAR)); + MessageBox(0, msg, caption, MB_ICONINFORMATION); + } } } diff --git a/base/applications/regedit/lang/bg-BG.rc b/base/applications/regedit/lang/bg-BG.rc index 16c3f5ec0c4..c7bd4215245 100644 --- a/base/applications/regedit/lang/bg-BG.rc +++ b/base/applications/regedit/lang/bg-BG.rc @@ -438,7 +438,7 @@ CAPTION " FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&",IDCANCEL,93,29,45,14 LTEXT " ...",IDC_STATIC,33,12,105,8 END diff --git a/base/applications/regedit/lang/cs-CZ.rc b/base/applications/regedit/lang/cs-CZ.rc index 8376b262eaa..8f36dadaf0d 100644 --- a/base/applications/regedit/lang/cs-CZ.rc +++ b/base/applications/regedit/lang/cs-CZ.rc @@ -438,7 +438,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/de-DE.rc b/base/applications/regedit/lang/de-DE.rc index 2b0a22cd2af..3b2b646f738 100644 --- a/base/applications/regedit/lang/de-DE.rc +++ b/base/applications/regedit/lang/de-DE.rc @@ -438,7 +438,7 @@ CAPTION "Suchen" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Abbrechen",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Abbrechen",IDCANCEL,93,29,45,14 LTEXT "Durchsuche die Registry...",IDC_STATIC,33,12,85,8 END diff --git a/base/applications/regedit/lang/el-GR.rc b/base/applications/regedit/lang/el-GR.rc index bb8f6bb3aa5..34e4202d15d 100644 --- a/base/applications/regedit/lang/el-GR.rc +++ b/base/applications/regedit/lang/el-GR.rc @@ -438,7 +438,7 @@ CAPTION " FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&",IDCANCEL,93,29,45,14 LTEXT " registry...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/en-US.rc b/base/applications/regedit/lang/en-US.rc index 5bc1ca6c4a6..b7e948f8a9a 100644 --- a/base/applications/regedit/lang/en-US.rc +++ b/base/applications/regedit/lang/en-US.rc @@ -435,7 +435,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/es-ES.rc b/base/applications/regedit/lang/es-ES.rc index 48db017a168..b7e703048da 100644 --- a/base/applications/regedit/lang/es-ES.rc +++ b/base/applications/regedit/lang/es-ES.rc @@ -441,7 +441,7 @@ CAPTION "Buscar" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancelar",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancelar",IDCANCEL,93,29,45,14 LTEXT "Buscando en el registro...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/fr-FR.rc b/base/applications/regedit/lang/fr-FR.rc index 3ee1d3bad64..ed997425aff 100644 --- a/base/applications/regedit/lang/fr-FR.rc +++ b/base/applications/regedit/lang/fr-FR.rc @@ -430,7 +430,7 @@ CAPTION "Chercher" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "Annuler",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "Annuler",IDCANCEL,93,29,45,14 LTEXT "Recherche dans le registre...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/hu-HU.rc b/base/applications/regedit/lang/hu-HU.rc index a59356e2f4d..3c7277b79ab 100644 --- a/base/applications/regedit/lang/hu-HU.rc +++ b/base/applications/regedit/lang/hu-HU.rc @@ -439,7 +439,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/id-ID.rc b/base/applications/regedit/lang/id-ID.rc index 4f602ff4d77..c6b9bb1cb49 100644 --- a/base/applications/regedit/lang/id-ID.rc +++ b/base/applications/regedit/lang/id-ID.rc @@ -438,7 +438,7 @@ CAPTION "Cari" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Batal",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Batal",IDCANCEL,93,29,45,14 LTEXT "Mencari registri...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/it-IT.rc b/base/applications/regedit/lang/it-IT.rc index c5f274986a9..47960b8da5b 100644 --- a/base/applications/regedit/lang/it-IT.rc +++ b/base/applications/regedit/lang/it-IT.rc @@ -443,7 +443,7 @@ CAPTION "Trova" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Annulla",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Annulla",IDCANCEL,93,29,45,14 LTEXT "Ricerca in corso nel registro...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/ja-JP.rc b/base/applications/regedit/lang/ja-JP.rc index 25c8a04ae39..3108fb8aa34 100644 --- a/base/applications/regedit/lang/ja-JP.rc +++ b/base/applications/regedit/lang/ja-JP.rc @@ -423,9 +423,9 @@ BEGIN CONTROL "f[^(&D)",IDC_LOOKAT_DATA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,60,42,8 CONTROL "SɈv̂(&W)",IDC_MATCHSTRING,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,83,32,94,13 + BS_AUTOCHECKBOX | WS_TABSTOP,83,32,109,13 CONTROL "啶Əʂ(&C)",IDC_MATCHCASE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,83,48,90,12 + WS_TABSTOP,83,48,108,12 END IDD_FINDING DIALOGEX 0, 0, 145, 50 @@ -435,7 +435,7 @@ CAPTION " FONT 9, "MS UI Gothic", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "LZ(&C)",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "LZ(&C)",IDCANCEL,93,29,45,14 LTEXT "WXǧ...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/ko-KR.rc b/base/applications/regedit/lang/ko-KR.rc index b4bd99c2fe6..5aef6a1b358 100644 --- a/base/applications/regedit/lang/ko-KR.rc +++ b/base/applications/regedit/lang/ko-KR.rc @@ -423,7 +423,7 @@ CAPTION "ã FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "(&C)",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "(&C)",IDCANCEL,93,29,45,14 LTEXT "Ʈ ˻...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/nl-NL.rc b/base/applications/regedit/lang/nl-NL.rc index 0596b96fd36..158a4ec4d24 100644 --- a/base/applications/regedit/lang/nl-NL.rc +++ b/base/applications/regedit/lang/nl-NL.rc @@ -438,7 +438,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/no-NO.rc b/base/applications/regedit/lang/no-NO.rc index 4d5073eb232..ac3e7faa330 100644 --- a/base/applications/regedit/lang/no-NO.rc +++ b/base/applications/regedit/lang/no-NO.rc @@ -438,7 +438,7 @@ CAPTION "S FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Avbryt",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Avbryt",IDCANCEL,93,29,45,14 LTEXT "Sker i registret...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/pl-PL.rc b/base/applications/regedit/lang/pl-PL.rc index bfa9294fecc..ebf6da04151 100644 --- a/base/applications/regedit/lang/pl-PL.rc +++ b/base/applications/regedit/lang/pl-PL.rc @@ -443,7 +443,7 @@ CAPTION "Znajd FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Anuluj",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Anuluj",IDCANCEL,93,29,45,14 LTEXT "Przeszukiwanie rejestru...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/pt-BR.rc b/base/applications/regedit/lang/pt-BR.rc index 4d26aae272e..9c1f7245ec4 100644 --- a/base/applications/regedit/lang/pt-BR.rc +++ b/base/applications/regedit/lang/pt-BR.rc @@ -439,7 +439,7 @@ CAPTION "Localizar" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancelar",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancelar",IDCANCEL,93,29,45,14 LTEXT "Pesquisando o registro...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/pt-PT.rc b/base/applications/regedit/lang/pt-PT.rc index 5f2806df457..081ba3b0800 100644 --- a/base/applications/regedit/lang/pt-PT.rc +++ b/base/applications/regedit/lang/pt-PT.rc @@ -439,7 +439,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/ru-RU.rc b/base/applications/regedit/lang/ru-RU.rc index e14ec89cee4..3d38ed24f01 100644 --- a/base/applications/regedit/lang/ru-RU.rc +++ b/base/applications/regedit/lang/ru-RU.rc @@ -438,7 +438,7 @@ CAPTION " FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT, IDC_STATIC, 7, 7, 20, 20 - PUSHBUTTON "&", IDCANCEL, 93, 29, 45, 14 + DEFPUSHBUTTON "&", IDCANCEL, 93, 29, 45, 14 LTEXT " ...", IDC_STATIC, 33, 12, 83, 8 END diff --git a/base/applications/regedit/lang/sk-SK.rc b/base/applications/regedit/lang/sk-SK.rc index b1a8cf6686d..1ef4df97081 100644 --- a/base/applications/regedit/lang/sk-SK.rc +++ b/base/applications/regedit/lang/sk-SK.rc @@ -423,7 +423,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Zrui",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Zrui",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/sl-SI.rc b/base/applications/regedit/lang/sl-SI.rc index 356d08426d6..5c529ffe6fb 100644 --- a/base/applications/regedit/lang/sl-SI.rc +++ b/base/applications/regedit/lang/sl-SI.rc @@ -438,7 +438,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/sv-SE.rc b/base/applications/regedit/lang/sv-SE.rc index 09c06639d31..efce60a4190 100644 --- a/base/applications/regedit/lang/sv-SE.rc +++ b/base/applications/regedit/lang/sv-SE.rc @@ -435,7 +435,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/th-TH.rc b/base/applications/regedit/lang/th-TH.rc index 72220f9a150..d69da60f90e 100644 --- a/base/applications/regedit/lang/th-TH.rc +++ b/base/applications/regedit/lang/th-TH.rc @@ -438,7 +438,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/uk-UA.rc b/base/applications/regedit/lang/uk-UA.rc index ff7d13965e4..e7d53f0f883 100644 --- a/base/applications/regedit/lang/uk-UA.rc +++ b/base/applications/regedit/lang/uk-UA.rc @@ -438,7 +438,7 @@ CAPTION " FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&",IDCANCEL,93,29,45,14 LTEXT " ...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/lang/zh-CN.rc b/base/applications/regedit/lang/zh-CN.rc index 875aff13ed8..87a1e6fd5e4 100644 --- a/base/applications/regedit/lang/zh-CN.rc +++ b/base/applications/regedit/lang/zh-CN.rc @@ -438,7 +438,7 @@ CAPTION " FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "ȡ(&C)",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "ȡ(&C)",IDCANCEL,93,29,45,14 LTEXT "ע...",IDC_STATIC,33,12,83,8 END diff --git a/base/applications/regedit/listview.c b/base/applications/regedit/listview.c index 64a6e123ef4..6e95a863ff9 100644 --- a/base/applications/regedit/listview.c +++ b/base/applications/regedit/listview.c @@ -27,6 +27,7 @@ int Image_String = 0; int Image_Bin = 0; +INT iListViewSelect = -1; typedef struct tagLINE_INFO { @@ -76,6 +77,29 @@ LPCTSTR GetValueName(HWND hwndLV, int iStartAt) return lineinfo->name; } +VOID SetValueName(HWND hwndLV, LPCTSTR pszValueName) +{ + INT i, c; + LV_FINDINFO fi; + + c = ListView_GetItemCount(hwndLV); + for(i = 0; i < c; i++) + { + ListView_SetItemState(hwndLV, i, 0, LVIS_FOCUSED | LVIS_SELECTED); + } + if (pszValueName == NULL) + i = 0; + else + { + fi.flags = LVFI_STRING; + fi.psz = pszValueName; + i = ListView_FindItem(hwndLV, -1, &fi); + } + ListView_SetItemState(hwndLV, i, LVIS_FOCUSED | LVIS_SELECTED, + LVIS_FOCUSED | LVIS_SELECTED); + iListViewSelect = i; +} + BOOL IsDefaultValue(HWND hwndLV, int i) { PLINE_INFO lineinfo; @@ -497,6 +521,7 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCTSTR keyPath) DWORD val_count; HKEY hNewKey; LONG errCode; + INT i, c; BOOL AddedDefault = FALSE; if (!hwndLV) return FALSE; @@ -552,7 +577,15 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCTSTR keyPath) { AddEntryToList(hwndLV, _T(""), REG_SZ, NULL, 0, 0, FALSE); } - (void)ListView_SortItems(hwndLV, CompareFunc, (WPARAM)hwndLV); + ListView_SortItems(hwndLV, CompareFunc, (WPARAM)hwndLV); + c = ListView_GetItemCount(hwndLV); + for(i = 0; i < c; i++) + { + ListView_SetItemState(hwndLV, i, 0, LVIS_FOCUSED | LVIS_SELECTED); + } + ListView_SetItemState(hwndLV, iListViewSelect, + LVIS_FOCUSED | LVIS_SELECTED, + LVIS_FOCUSED | LVIS_SELECTED); RegCloseKey(hNewKey); SendMessage(hwndLV, WM_SETREDRAW, TRUE, 0); diff --git a/base/applications/regedit/regproc.c b/base/applications/regedit/regproc.c index c67e05df7a6..2ba45c29faf 100644 --- a/base/applications/regedit/regproc.c +++ b/base/applications/regedit/regproc.c @@ -1497,147 +1497,6 @@ done: return lResult; } -/****************************************************************************** - * Searching - */ - -static LONG RegNextKey(HKEY hKey, LPTSTR lpSubKey, size_t iSubKeyLength) -{ - LONG lResult; - LPTSTR s; - LPCTSTR pszOriginalKey; - TCHAR szKeyName[256]; - HKEY hSubKey, hBaseKey; - DWORD dwIndex = 0; - DWORD cbName; - FILETIME ft; - BOOL bFoundKey = FALSE; - - /* Try accessing a subkey */ - if (RegOpenKeyEx(hKey, lpSubKey, 0, KEY_ALL_ACCESS, &hSubKey) == ERROR_SUCCESS) - { - cbName = (DWORD) iSubKeyLength - _tcslen(lpSubKey) - 1; - lResult = RegEnumKeyEx(hSubKey, 0, lpSubKey + _tcslen(lpSubKey) + 1, - &cbName, NULL, NULL, NULL, &ft); - RegCloseKey(hSubKey); - - if (lResult == ERROR_SUCCESS) - { - lpSubKey[_tcslen(lpSubKey)] = '\\'; - bFoundKey = TRUE; - } - } - - if (!bFoundKey) - { - /* Go up and find the next sibling key */ - do - { - s = _tcsrchr(lpSubKey, TEXT('\\')); - if (s) - { - *s = '\0'; - pszOriginalKey = s + 1; - - hBaseKey = NULL; - RegOpenKeyEx(hKey, lpSubKey, 0, KEY_ALL_ACCESS, &hBaseKey); - } - else - { - pszOriginalKey = lpSubKey; - hBaseKey = hKey; - } - - if (hBaseKey) - { - dwIndex = 0; - do - { - lResult = RegEnumKey(hBaseKey, dwIndex++, szKeyName, sizeof(szKeyName) / sizeof(szKeyName[0])); - } - while((lResult == ERROR_SUCCESS) && _tcscmp(szKeyName, pszOriginalKey)); - - if (lResult == ERROR_SUCCESS) - { - lResult = RegEnumKey(hBaseKey, dwIndex++, szKeyName, sizeof(szKeyName) / sizeof(szKeyName[0])); - if (lResult == ERROR_SUCCESS) - { - bFoundKey = TRUE; - _sntprintf(lpSubKey + _tcslen(lpSubKey), iSubKeyLength - _tcslen(lpSubKey), _T("\\%s"), szKeyName); - } - } - RegCloseKey(hBaseKey); - } - } - while(!bFoundKey); - } - return bFoundKey ? ERROR_SUCCESS : ERROR_NO_MORE_ITEMS; -} - -static BOOL RegSearchCompare(LPCTSTR s1, LPCTSTR s2, DWORD dwSearchFlags) -{ - BOOL bResult; - if (dwSearchFlags & RSF_WHOLESTRING) - { - if (dwSearchFlags & RSF_MATCHCASE) - bResult = !_tcscmp(s1, s2); - else - bResult = !_tcsicmp(s1, s2); - } - else - { - if (dwSearchFlags & RSF_MATCHCASE) - bResult = (_tcsstr(s1, s2) != NULL); - else - { - /* My kingdom for _tcsistr() */ - bResult = FALSE; - while(*s1) - { - if (!_tcsnicmp(s1, s2, _tcslen(s2))) - { - bResult = TRUE; - break; - } - s1++; - } - } - } - return bResult; -} - -LONG RegSearch(HKEY hKey, LPTSTR lpSubKey, size_t iSubKeyLength, - LPCTSTR pszSearchString, DWORD dwValueIndex, - DWORD dwSearchFlags, BOOL (*pfnCallback)(LPVOID), LPVOID lpParam) -{ - LONG lResult; - LPCTSTR s; - - UNREFERENCED_PARAMETER(dwValueIndex); - - if (dwSearchFlags & (RSF_LOOKATVALUES | RSF_LOOKATDATA)) - return ERROR_CALL_NOT_IMPLEMENTED; /* NYI */ - - do - { - if (pfnCallback) - { - if (pfnCallback(lpParam)) - return ERROR_OPERATION_ABORTED; - } - - lResult = RegNextKey(hKey, lpSubKey, iSubKeyLength); - if (lResult != ERROR_SUCCESS) - return lResult; - - s = _tcsrchr(lpSubKey, TEXT('\\')); - s = s ? s + 1 : lpSubKey; - } - while(!(dwSearchFlags & RSF_LOOKATKEYS) || !RegSearchCompare(s, pszSearchString, dwSearchFlags)); - - return ERROR_SUCCESS; -} - /****************************************************************************** * Key naming and parsing */ diff --git a/base/applications/regedit/regproc.h b/base/applications/regedit/regproc.h index 15bb2484728..aae3a4a969b 100644 --- a/base/applications/regedit/regproc.h +++ b/base/applications/regedit/regproc.h @@ -92,10 +92,6 @@ LONG RegQueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTST #define RSF_LOOKATDATA 0x00000008 #define RSF_MATCHCASE 0x00010000 -LONG RegSearch(HKEY hKey, LPTSTR lpSubKey, size_t iSubKeyLength, - LPCTSTR pszSearchString, DWORD dwValueIndex, - DWORD dwSearchFlags, BOOL (*pfnCallback)(LPVOID), LPVOID lpParam); - BOOL RegKeyGetName(LPTSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCTSTR lpSubKey); /* EOF */ diff --git a/boot/bootdata/hivesft_arm.inf b/boot/bootdata/hivesft_arm.inf index a3a273ff646..aabd6e10a34 100644 --- a/boot/bootdata/hivesft_arm.inf +++ b/boot/bootdata/hivesft_arm.inf @@ -1126,4 +1126,8 @@ HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\Device\shellex\P ; Keyboard layout switcher ;HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Run","kbswitch",0x00000000,"kbswitch.exe" +; SvcHost services +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost",,0x00000012 +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost", "netsvcs",0x00010000,"" + ; EOF diff --git a/boot/bootdata/hivesft_i386.inf b/boot/bootdata/hivesft_i386.inf index 006796e8779..b65d55aa471 100644 --- a/boot/bootdata/hivesft_i386.inf +++ b/boot/bootdata/hivesft_i386.inf @@ -1262,4 +1262,8 @@ HKLM,"SOFTWARE\Microsoft\Ole","EnableRemoteConnect",0x00000000,"N" ; Keyboard layout switcher ;HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Run","kbswitch",0x00000000,"kbswitch.exe" +; SvcHost services +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost",,0x00000012 +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost", "netsvcs",0x00010000,"" + ; EOF diff --git a/boot/bootdata/hivesys_i386.inf b/boot/bootdata/hivesys_i386.inf index 7cc0db18b8f..8c2bb4f401a 100644 --- a/boot/bootdata/hivesys_i386.inf +++ b/boot/bootdata/hivesys_i386.inf @@ -973,6 +973,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Description",0x00000000,"P HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","ErrorControl",0x00010001,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Group",0x00000000,"Audio" HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","ImagePath",0x00020000,"%SystemRoot%\system32\audiosrv.exe" +HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","ObjectName",0x00000000,"LocalSystem" HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Start",0x00010001,0x00000003 HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Type",0x00010001,0x00000010 @@ -1219,6 +1220,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","DisplayName",0x00000000,"Simpl HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Group",0x00000000,"Network" HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","ImagePath",0x00020000,"%SystemRoot%\system32\tcpsvcs.exe" +HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","ObjectName",0x00000000,"LocalSystem" HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Start",0x00010001,0x00000003 HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Type",0x00010001,0x00000020 @@ -1228,6 +1230,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","DisplayName",0x00000000,"React 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" +HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","ObjectName",0x00000000,"LocalSystem" HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Start",0x00010001,0x00000003 HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Type",0x00010001,0x00000020 @@ -1308,6 +1311,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","Description",0x00000000,"Con HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","Group",0x00000000,"Windows Installer" HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","ImagePath",0x00020000,"system32\msiexec.exe /V" +HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","ObjectName",0x00000000,"LocalSystem" HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","Start",0x00010001,0x00000003 HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","Type",0x00010001,0x00000020 diff --git a/dll/win32/kernel32/mem/global.c b/dll/win32/kernel32/mem/global.c index 9537cbc774a..f2cfca5b01c 100644 --- a/dll/win32/kernel32/mem/global.c +++ b/dll/win32/kernel32/mem/global.c @@ -380,44 +380,53 @@ GlobalLock(HGLOBAL hMem) /* Check if this was a simple allocated heap entry */ if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) { - /* Then simply return the pointer */ - return hMem; + /* Verify and return the pointer */ + return IsBadReadPtr(hMem, 1) ? NULL : hMem; } /* Otherwise, lock the heap */ RtlLockHeap(hProcessHeap); - /* Get the handle entry */ - HandleEntry = BaseHeapGetEntry(hMem); - BASE_TRACE_HANDLE(HandleEntry, hMem); + _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) + /* Make sure it's valid */ + if (!BaseHeapValidateEntry(HandleEntry)) { - /* Increase the lock count, unless we've went too far */ - if (HandleEntry->LockCount++ == GMEM_LOCKCOUNT) - { - /* In which case we simply unlock once */ - HandleEntry->LockCount--; - } + /* It's not, fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_HANDLE); + Ptr = NULL; } else { - /* The handle is still there but the memory was already freed */ - SetLastError(ERROR_DISCARDED); + /* 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); @@ -702,65 +711,74 @@ GlobalSize(HGLOBAL hMem) /* Lock the heap */ RtlLockHeap(hProcessHeap); - /* Check if this is a simple RTL Heap Managed block */ - if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) + _SEH2_TRY { - /* 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)) + /* Check if this is a simple RTL Heap Managed block */ + if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) { - /* This implies we're not a handle heap, so use the generic call */ - dwSize = RtlSizeHeap(hProcessHeap, HEAP_NO_SERIALIZE, hMem); + /* 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; + } } - else + + /* Make sure that this is an entry in our handle database */ + if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY) { - /* Otherwise we're a handle heap, so get the internal handle */ - hMem = Handle; + /* 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); + } } - } - /* 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)) + /* Check if by now, we still haven't gotten any useful size */ + if (dwSize == MAXULONG_PTR) { /* 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); + dwSize = 0; } } - - /* Check if by now, we still haven't gotten any useful size */ - if (dwSize == MAXULONG_PTR) + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - /* Fail */ - BASE_TRACE_FAILURE(); SetLastError(ERROR_INVALID_HANDLE); dwSize = 0; } + _SEH2_END /* All done! Unlock heap and return the size */ RtlUnlockHeap(hProcessHeap); @@ -798,31 +816,40 @@ GlobalUnlock(HGLOBAL hMem) HandleEntry = BaseHeapGetEntry(hMem); BASE_TRACE_HANDLE(HandleEntry, hMem); - /* Make sure it's valid */ - if (!BaseHeapValidateEntry(HandleEntry)) + _SEH2_TRY { - /* It's not, fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_INVALID_HANDLE); + /* 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; } - 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_END /* All done. Unlock the heap and return the pointer */ RtlUnlockHeap(hProcessHeap); diff --git a/dll/win32/kernel32/misc/console.c b/dll/win32/kernel32/misc/console.c index 7ead208edf2..594b8ac2abb 100644 --- a/dll/win32/kernel32/misc/console.c +++ b/dll/win32/kernel32/misc/console.c @@ -993,11 +993,11 @@ OpenConsoleW(LPCWSTR wsName, ULONG CsrRequest; NTSTATUS Status = STATUS_SUCCESS; - if (0 == _wcsicmp(wsName, L"CONIN$")) + if (wsName && 0 == _wcsicmp(wsName, L"CONIN$")) { CsrRequest = MAKE_CSR_API(GET_INPUT_HANDLE, CSR_NATIVE); } - else if (0 == _wcsicmp(wsName, L"CONOUT$")) + else if (wsName && 0 == _wcsicmp(wsName, L"CONOUT$")) { CsrRequest = MAKE_CSR_API(GET_OUTPUT_HANDLE, CSR_NATIVE); } diff --git a/dll/win32/kernel32/misc/nls.c b/dll/win32/kernel32/misc/nls.c index 58a5b81c294..4e082011b17 100644 --- a/dll/win32/kernel32/misc/nls.c +++ b/dll/win32/kernel32/misc/nls.c @@ -1260,6 +1260,170 @@ IsValidCodePage(UINT CodePage) return GetCPFileNameFromRegistry(CodePage, NULL, 0); } +static const signed char +base64inv[] = +{ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, + -1, 0, 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, -1, -1, -1, -1, -1, + -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 +}; + +static VOID Utf7Base64Decode(BYTE *pbDest, LPCSTR pszSrc, INT cchSrc) +{ + INT i, j, n; + BYTE b; + + for(i = 0; i < cchSrc / 4 * 4; i += 4) + { + for(j = n = 0; j < 4; ) + { + b = (BYTE) base64inv[(BYTE) *pszSrc++]; + n |= (((INT) b) << ((3 - j) * 6)); + j++; + } + for(j = 0; j < 3; j++) + *pbDest++ = (BYTE) ((n >> (8 * (2 - j))) & 0xFF); + } + for(j = n = 0; j < cchSrc % 4; ) + { + b = (BYTE) base64inv[(BYTE) *pszSrc++]; + n |= (((INT) b) << ((3 - j) * 6)); + j++; + } + for(j = 0; j < ((cchSrc % 4) * 6 / 8); j++) + *pbDest++ = (BYTE) ((n >> (8 * (2 - j))) & 0xFF); +} + +static VOID myswab(LPVOID pv, INT cw) +{ + LPBYTE pb = (LPBYTE) pv; + BYTE b; + while(cw > 0) + { + b = *pb; + *pb = pb[1]; + pb[1] = b; + pb += 2; + cw--; + } +} + +static INT Utf7ToWideCharSize(LPCSTR pszUtf7, INT cchUtf7) +{ + INT n, c, cch; + CHAR ch; + LPCSTR pch; + + c = 0; + while(cchUtf7 > 0) + { + ch = *pszUtf7++; + if (ch == '+') + { + ch = *pszUtf7; + if (ch == '-') + { + c++; + pszUtf7++; + cchUtf7 -= 2; + continue; + } + cchUtf7--; + pch = pszUtf7; + while(cchUtf7 > 0 && (BYTE) *pszUtf7 < 0x80 && + base64inv[*pszUtf7] >= 0) + { + cchUtf7--; + pszUtf7++; + } + cch = pszUtf7 - pch; + n = (cch * 3) / 8; + c += n; + if (cchUtf7 > 0 && *pszUtf7 == '-') + { + pszUtf7++; + cchUtf7--; + } + } + else + { + c++; + cchUtf7--; + } + } + + return c; +} + +static INT Utf7ToWideChar(LPCSTR pszUtf7, INT cchUtf7, LPWSTR pszWide, INT cchWide) +{ + INT n, c, cch; + CHAR ch; + LPCSTR pch; + WORD *pwsz; + + c = Utf7ToWideCharSize(pszUtf7, cchUtf7); + if (cchWide == 0) + return c; + + if (cchWide < c) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + + while(cchUtf7 > 0) + { + ch = *pszUtf7++; + if (ch == '+') + { + if (*pszUtf7 == '-') + { + *pszWide++ = L'+'; + pszUtf7++; + cchUtf7 -= 2; + continue; + } + cchUtf7--; + pch = pszUtf7; + while(cchUtf7 > 0 && (BYTE) *pszUtf7 < 0x80 && + base64inv[*pszUtf7] >= 0) + { + cchUtf7--; + pszUtf7++; + } + cch = pszUtf7 - pch; + n = (cch * 3) / 8; + pwsz = (WORD *) HeapAlloc(GetProcessHeap(), 0, (n + 1) * sizeof(WORD)); + if (pwsz == NULL) + return 0; + ZeroMemory(pwsz, n * sizeof(WORD)); + Utf7Base64Decode((BYTE *) pwsz, pch, cch); + myswab(pwsz, n); + CopyMemory(pszWide, pwsz, n * sizeof(WORD)); + HeapFree(GetProcessHeap(), 0, pwsz); + pszWide += n; + if (cchUtf7 > 0 && *pszUtf7 == '-') + { + pszUtf7++; + cchUtf7--; + } + } + else + { + *pszWide++ = (WCHAR) ch; + cchUtf7--; + } + } + + return c; +} + /** * @name MultiByteToWideChar * @@ -1325,8 +1489,13 @@ MultiByteToWideChar(UINT CodePage, WideCharCount); case CP_UTF7: - DPRINT1("MultiByteToWideChar for CP_UTF7 is not implemented!\n"); - return 0; + if (Flags) + { + SetLastError(ERROR_INVALID_FLAGS); + return 0; + } + return Utf7ToWideChar(MultiByteString, MultiByteCount, + WideCharString, WideCharCount); case CP_SYMBOL: return IntMultiByteToWideCharSYMBOL(Flags, @@ -1344,6 +1513,162 @@ MultiByteToWideChar(UINT CodePage, } } +static const char mustshift[] = +{ + 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 +}; + +static const char base64[] = +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +static INT WideCharToUtf7Size(LPCWSTR pszWide, INT cchWide) +{ + WCHAR wch; + INT c = 0; + BOOL fShift = FALSE; + + while(cchWide > 0) + { + wch = *pszWide; + if (wch < 0x80 && !mustshift[wch]) + { + c++; + cchWide--; + pszWide++; + } + else + { + if (wch == L'+') + { + c++; + c++; + cchWide--; + pszWide++; + continue; + } + if (!fShift) + { + c++; + fShift = TRUE; + } + pszWide++; + cchWide--; + c += 3; + if (cchWide > 0 && (*pszWide >= 0x80 || mustshift[*pszWide])) + { + pszWide++; + cchWide--; + c += 3; + if (cchWide > 0 && (*pszWide >= 0x80 || mustshift[*pszWide])) + { + pszWide++; + cchWide--; + c += 2; + } + } + if (cchWide > 0 && *pszWide < 0x80 && !mustshift[*pszWide]) + { + c++; + fShift = FALSE; + } + } + } + if (fShift) + c++; + + return c; +} + +static INT WideCharToUtf7(LPCWSTR pszWide, INT cchWide, LPSTR pszUtf7, INT cchUtf7) +{ + WCHAR wch; + INT c, n; + WCHAR wsz[3]; + BOOL fShift = FALSE; + + c = WideCharToUtf7Size(pszWide, cchWide); + if (cchUtf7 == 0) + return c; + + if (cchUtf7 < c) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + + while(cchWide > 0) + { + wch = *pszWide; + if (wch < 0x80 && !mustshift[wch]) + { + *pszUtf7++ = (CHAR) wch; + cchWide--; + pszWide++; + } + else + { + if (wch == L'+') + { + *pszUtf7++ = '+'; + *pszUtf7++ = '-'; + cchWide--; + pszWide++; + continue; + } + if (!fShift) + { + *pszUtf7++ = '+'; + fShift = TRUE; + } + wsz[0] = *pszWide++; + cchWide--; + n = 1; + if (cchWide > 0 && (*pszWide >= 0x80 || mustshift[*pszWide])) + { + wsz[1] = *pszWide++; + cchWide--; + n++; + if (cchWide > 0 && (*pszWide >= 0x80 || mustshift[*pszWide])) + { + wsz[2] = *pszWide++; + cchWide--; + n++; + } + } + *pszUtf7++ = base64[wsz[0] >> 10]; + *pszUtf7++ = base64[(wsz[0] >> 4) & 0x3F]; + *pszUtf7++ = base64[(wsz[0] << 2 | wsz[1] >> 14) & 0x3F]; + if (n >= 2) + { + *pszUtf7++ = base64[(wsz[1] >> 8) & 0x3F]; + *pszUtf7++ = base64[(wsz[1] >> 2) & 0x3F]; + *pszUtf7++ = base64[(wsz[1] << 4 | wsz[2] >> 12) & 0x3F]; + if (n >= 3) + { + *pszUtf7++ = base64[(wsz[2] >> 6) & 0x3F]; + *pszUtf7++ = base64[wsz[2] & 0x3F]; + } + } + if (cchWide > 0 && *pszWide < 0x80 && !mustshift[*pszWide]) + { + *pszUtf7++ = '-'; + fShift = FALSE; + } + } + } + if (fShift) + *pszUtf7 = '-'; + + return c; +} + /** * @name WideCharToMultiByte * @@ -1423,8 +1748,18 @@ WideCharToMultiByte(UINT CodePage, UsedDefaultChar); case CP_UTF7: - DPRINT1("WideCharToMultiByte for CP_UTF7 is not implemented!\n"); - return 0; + if (DefaultChar != NULL || UsedDefaultChar != NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + if (Flags) + { + SetLastError(ERROR_INVALID_FLAGS); + return 0; + } + return WideCharToUtf7(WideCharString, WideCharCount, + MultiByteString, MultiByteCount); case CP_SYMBOL: if ((DefaultChar!=NULL) || (UsedDefaultChar!=NULL)) diff --git a/dll/win32/kernel32/misc/utils.c b/dll/win32/kernel32/misc/utils.c index cebd500232b..04fde77fc82 100644 --- a/dll/win32/kernel32/misc/utils.c +++ b/dll/win32/kernel32/misc/utils.c @@ -364,7 +364,7 @@ BasepInitializeContext(IN PCONTEXT Context, } else if (ContextType == 2) /* For Fibers */ { - //Context->Eip = (ULONG)BaseFiberStartup; + Context->Eip = (ULONG)BaseFiberStartup; } else /* For first thread in a Process */ { diff --git a/dll/win32/kernel32/thread/fiber.c b/dll/win32/kernel32/thread/fiber.c index 656bc6ee19d..6ba2016b648 100644 --- a/dll/win32/kernel32/thread/fiber.c +++ b/dll/win32/kernel32/thread/fiber.c @@ -146,9 +146,8 @@ CreateFiberEx(SIZE_T dwStackCommitSize, PFIBER pfCurFiber; NTSTATUS nErrCode; INITIAL_TEB usFiberInitialTeb; - CONTEXT ctxFiberContext; PVOID ActivationContextStack = NULL; - DPRINT1("Creating Fiber\n"); + DPRINT("Creating Fiber\n"); #ifdef SXS_SUPPORT_ENABLED /* Allocate the Activation Context Stack */ @@ -203,7 +202,7 @@ CreateFiberEx(SIZE_T dwStackCommitSize, } /* initialize the context for the fiber */ - BasepInitializeContext(&ctxFiberContext, + BasepInitializeContext(&pfCurFiber->Context, lpParameter, lpStartAddress, usFiberInitialTeb.StackBase, @@ -253,10 +252,10 @@ WINAPI BaseFiberStartup(VOID) { #ifdef _M_IX86 - PFIBER Fiber = GetFiberData(); + PFIBER Fiber = GetCurrentFiber(); /* Call the Thread Startup Routine */ - DPRINT1("Starting Fiber\n"); + DPRINT("Starting Fiber\n"); BaseThreadStartup((LPTHREAD_START_ROUTINE)Fiber->Context.Eax, (LPVOID)Fiber->Context.Ebx); #else diff --git a/dll/win32/kernel32/thread/i386/fiber.S b/dll/win32/kernel32/thread/i386/fiber.S index cf8bbe06064..57358ffeed4 100644 --- a/dll/win32/kernel32/thread/i386/fiber.S +++ b/dll/win32/kernel32/thread/i386/fiber.S @@ -24,7 +24,11 @@ _SwitchToFiber@4: 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 | CONTEXT_FLOATING_POINT jnz NoFpuStateSave @@ -115,7 +119,7 @@ NoFpuStateRestore: mov eax, [ecx+FIBER_FLS_DATA] mov [edx+TEB_FLS_DATA], eax - /* Return */ - ret 4 - + /* Jump to new fiber */ + jmp [ecx+FIBER_CONTEXT_EIP] + /* EOF */ diff --git a/dll/win32/qmgr/qmgr.inf b/dll/win32/qmgr/qmgr.inf index ef51f9b3d99..c3d0380cd90 100644 --- a/dll/win32/qmgr/qmgr.inf +++ b/dll/win32/qmgr/qmgr.inf @@ -12,5 +12,5 @@ HKCR,"AppID\BITS","AppID",,"%CLSID_BackgroundCopyQMgr%" HKCR,"AppID\%CLSID_BackgroundCopyQMgr%","LocalService",,"BITS" HKCR,"CLSID\%CLSID_BackgroundCopyManager%","AppID",,"%CLSID_BackgroundCopyQMgr%" -HKLM,"Software\Microsoft\Windows NT\CurrentVersion\SvcHost","netsvcs",0x00010000,"BITS" +HKLM,"Software\Microsoft\Windows NT\CurrentVersion\SvcHost","netsvcs",0x00010008,"BITS" HKLM,"System\CurrentControlSet\Services\BITS\Parameters","ServiceDll",0x00020000,"qmgr.dll" diff --git a/dll/win32/setupapi/install.c b/dll/win32/setupapi/install.c index a89081c7d6d..0d1fd062321 100644 --- a/dll/win32/setupapi/install.c +++ b/dll/win32/setupapi/install.c @@ -250,7 +250,7 @@ static void append_multi_sz_value( HKEY hkey, const WCHAR *value, const WCHAR *s if (total != size) { TRACE( "setting value %s to %s\n", debugstr_w(value), debugstr_w(buffer) ); - RegSetValueExW( hkey, value, 0, REG_MULTI_SZ, (BYTE *)buffer, total ); + RegSetValueExW( hkey, value, 0, REG_MULTI_SZ, (BYTE *)buffer, total + sizeof(WCHAR) ); } done: HeapFree( GetProcessHeap(), 0, buffer ); diff --git a/dll/win32/user32/windows/menu.c b/dll/win32/user32/windows/menu.c index 1178558dda0..d5723bb3271 100644 --- a/dll/win32/user32/windows/menu.c +++ b/dll/win32/user32/windows/menu.c @@ -2206,8 +2206,8 @@ DrawMenuBarTemp(HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font) SelectObject(DC, GetStockObject(DC_PEN)); SetDCPenColor(DC, GetSysColor(COLOR_3DFACE)); - MoveToEx(DC, Rect->left, Rect->bottom, NULL); - LineTo(DC, Rect->right, Rect->bottom); + MoveToEx(DC, Rect->left, Rect->bottom - 1, NULL); + LineTo(DC, Rect->right, Rect->bottom - 1); if (0 == MenuInfo.MenuItemCount) { diff --git a/dll/win32/user32/windows/window.c b/dll/win32/user32/windows/window.c index 6ed38cce020..2aa01a9941d 100644 --- a/dll/win32/user32/windows/window.c +++ b/dll/win32/user32/windows/window.c @@ -287,6 +287,18 @@ CreateWindowExA(DWORD dwExStyle, POINT mPos[2]; UINT id = 0; HWND top_child; + PWND WndParent; + PCLS pcls; + + if(!(WndParent = ValidateHwnd(hWndParent)) || + !(pcls = DesktopPtrToUser(WndParent->pcls))) + return 0; + + if (pcls->fnid != FNID_MDICLIENT) + { + ERR("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent); + return 0; + } /* lpParams of WM_[NC]CREATE is different for MDI children. * MDICREATESTRUCT members have the originally passed values. @@ -399,6 +411,24 @@ CreateWindowExW(DWORD dwExStyle, POINT mPos[2]; UINT id = 0; HWND top_child; + PWND WndParent; + PCLS pcls; + + WndParent = ValidateHwnd(hWndParent); + + if(!WndParent) + return 0; + + pcls = DesktopPtrToUser(WndParent->pcls); + + if(!pcls) + return 0; + + if (pcls->fnid != FNID_MDICLIENT) + { + ERR("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent); + return 0; + } /* lpParams of WM_[NC]CREATE is different for MDI children. * MDICREATESTRUCT members have the originally passed values. diff --git a/dll/win32/userenv/lang/de-DE.rc b/dll/win32/userenv/lang/de-DE.rc index 3c28dc6f153..8795fd94c6f 100644 --- a/dll/win32/userenv/lang/de-DE.rc +++ b/dll/win32/userenv/lang/de-DE.rc @@ -44,5 +44,5 @@ BEGIN IDS_HISTORY "Lokale Einstellungen\\Verlauf" IDS_COOKIES "Cookies" IDS_PROGRAMFILES "%SystemDrive%\\Programme" - IDS_COMMONFILES "Common Files" + IDS_COMMONFILES "Gemeinsame Dateien" END diff --git a/dll/win32/userenv/lang/fr-FR.rc b/dll/win32/userenv/lang/fr-FR.rc index e95f2b0c52b..a3baf6ea524 100644 --- a/dll/win32/userenv/lang/fr-FR.rc +++ b/dll/win32/userenv/lang/fr-FR.rc @@ -44,5 +44,5 @@ BEGIN IDS_HISTORY "Local Settings\\Historique" IDS_COOKIES "Cookies" IDS_PROGRAMFILES "%SystemDrive%\\Program Files" - IDS_COMMONFILES "Common Files" + IDS_COMMONFILES "Fichiers communs" END diff --git a/drivers/network/afd/afd/read.c b/drivers/network/afd/afd/read.c index 3c6ddaa861f..dccfa559ba8 100644 --- a/drivers/network/afd/afd/read.c +++ b/drivers/network/afd/afd/read.c @@ -187,7 +187,7 @@ static NTSTATUS ReceiveActivity( PAFD_FCB FCB, PIRP Irp ) { } } - if( !FCB->Recv.Content ) { + if( FCB->Recv.Content ) { FCB->PollState |= AFD_EVENT_RECEIVE; } else FCB->PollState &= ~AFD_EVENT_RECEIVE; diff --git a/hal/halx86/hal_generic.rbuild b/hal/halx86/hal_generic.rbuild index 8dd5f7bc57d..3532d001d18 100644 --- a/hal/halx86/hal_generic.rbuild +++ b/hal/halx86/hal_generic.rbuild @@ -37,15 +37,15 @@ - . + x86bios.c - halinit.c - irq.S - misc.c - apic.c + + + + systimer.S - usage.c + diff --git a/hal/halx86/halamd64.rbuild b/hal/halx86/halamd64.rbuild index ad96c0f1cf9..92c4f29983d 100644 --- a/hal/halx86/halamd64.rbuild +++ b/hal/halx86/halamd64.rbuild @@ -13,7 +13,7 @@ hal_generic hal_generic_acpi ntoskrnl - x86emu + spinlock.c diff --git a/include/ndk/i386/asm.h b/include/ndk/i386/asm.h index eaaf2ae1bc4..f54529442e1 100644 --- a/include/ndk/i386/asm.h +++ b/include/ndk/i386/asm.h @@ -478,6 +478,7 @@ Author: #define FIBER_CONTEXT_ESI FIBER_CONTEXT + CONTEXT_ESI #define FIBER_CONTEXT_EDI FIBER_CONTEXT + CONTEXT_EDI #define FIBER_CONTEXT_EBP FIBER_CONTEXT + CONTEXT_EBP +#define FIBER_CONTEXT_EIP FIBER_CONTEXT + CONTEXT_EIP #define FIBER_CONTEXT_ESP FIBER_CONTEXT + CONTEXT_ESP #define FIBER_CONTEXT_DR6 FIBER_CONTEXT + CONTEXT_DR6 #define FIBER_CONTEXT_FLOAT_SAVE_STATUS_WORD FIBER_CONTEXT + CONTEXT_FLOAT_SAVE_STATUS_WORD diff --git a/subsystems/win32/csrss/win32csr/conio.c b/subsystems/win32/csrss/win32csr/conio.c index 6206a538786..493ac172db0 100644 --- a/subsystems/win32/csrss/win32csr/conio.c +++ b/subsystems/win32/csrss/win32csr/conio.c @@ -26,11 +26,14 @@ #define ConsoleInputUnicodeCharToAnsiChar(Console, dChar, sWChar) \ WideCharToMultiByte((Console)->CodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL) +#define ConsoleInputAnsiCharToUnicodeChar(Console, dWChar, sChar) \ + MultiByteToWideChar((Console)->CodePage, 0, (sChar), 1, (dWChar), 1) + #define ConsoleUnicodeCharToAnsiChar(Console, dChar, sWChar) \ WideCharToMultiByte((Console)->OutputCodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL) -#define ConsoleAnsiCharToUnicodeChar(Console, sWChar, dChar) \ - MultiByteToWideChar((Console)->OutputCodePage, 0, (dChar), 1, (sWChar), 1) +#define ConsoleAnsiCharToUnicodeChar(Console, dWChar, sChar) \ + MultiByteToWideChar((Console)->OutputCodePage, 0, (sChar), 1, (dWChar), 1) /* FUNCTIONS *****************************************************************/ @@ -616,7 +619,7 @@ CSR_API(CsrReadConsole) else { if(Request->Data.ReadConsoleRequest.Unicode) - UnicodeBuffer[i] = Input->InputEvent.Event.KeyEvent.uChar.AsciiChar; /* FIXME */ + ConsoleInputAnsiCharToUnicodeChar(Console, &UnicodeBuffer[i], &Input->InputEvent.Event.KeyEvent.uChar.AsciiChar); else Buffer[i] = Input->InputEvent.Event.KeyEvent.uChar.AsciiChar; } diff --git a/subsystems/win32/win32k/include/rect.h b/subsystems/win32/win32k/include/rect.h index 156dd55f120..e24bc4b0127 100644 --- a/subsystems/win32/win32k/include/rect.h +++ b/subsystems/win32/win32k/include/rect.h @@ -56,3 +56,7 @@ RECTL_bIntersectRect(RECTL *prclDst, const RECTL *prcl1, const RECTL *prcl2); VOID FASTCALL RECTL_vMakeWellOrdered(RECTL *prcl); + +VOID +FASTCALL +RECTL_vInflateRect(RECTL *rect, INT dx, INT dy); diff --git a/subsystems/win32/win32k/ntuser/menu.c b/subsystems/win32/win32k/ntuser/menu.c index 3b1cd6a740b..4da4922419d 100644 --- a/subsystems/win32/win32k/ntuser/menu.c +++ b/subsystems/win32/win32k/ntuser/menu.c @@ -1296,15 +1296,6 @@ IntCleanupMenus(struct _EPROCESS *Process, PPROCESSINFO Win32Process) return TRUE; } -VOID APIENTRY -co_InflateRect(RECTL *rect, int dx, int dy) -{ - rect->left -= dx; - rect->top -= dy; - rect->right += dx; - rect->bottom += dy; -} - BOOLEAN APIENTRY intGetTitleBarInfo(PWINDOW_OBJECT pWindowObject, PTITLEBARINFO bti) { @@ -1334,17 +1325,17 @@ intGetTitleBarInfo(PWINDOW_OBJECT pWindowObject, PTITLEBARINFO bti) if (HAS_THICKFRAME( dwStyle, dwExStyle )) { /* FIXME : Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXFRAME) and UserGetSystemMetrics(SM_CYFRAME) */ - co_InflateRect( &bti->rcTitleBar, -UserGetSystemMetrics(SM_CXFRAME), -UserGetSystemMetrics(SM_CYFRAME) ); + RECTL_vInflateRect( &bti->rcTitleBar, -UserGetSystemMetrics(SM_CXFRAME), -UserGetSystemMetrics(SM_CYFRAME) ); } else if (HAS_DLGFRAME( dwStyle, dwExStyle )) { /* FIXME : Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXDLGFRAME) and UserGetSystemMetrics(SM_CYDLGFRAME) */ - co_InflateRect( &bti->rcTitleBar, -UserGetSystemMetrics(SM_CXDLGFRAME), -UserGetSystemMetrics(SM_CYDLGFRAME)); + RECTL_vInflateRect( &bti->rcTitleBar, -UserGetSystemMetrics(SM_CXDLGFRAME), -UserGetSystemMetrics(SM_CYDLGFRAME)); } else if (HAS_THINFRAME( dwStyle, dwExStyle)) { /* FIXME : Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXBORDER) and UserGetSystemMetrics(SM_CYBORDER) */ - co_InflateRect( &bti->rcTitleBar, -UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER) ); + RECTL_vInflateRect( &bti->rcTitleBar, -UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER) ); } /* We have additional border information if the window @@ -1355,13 +1346,13 @@ intGetTitleBarInfo(PWINDOW_OBJECT pWindowObject, PTITLEBARINFO bti) if (dwExStyle & WS_EX_CLIENTEDGE) { /* FIXME : Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXEDGE) and UserGetSystemMetrics(SM_CYEDGE) */ - co_InflateRect (&bti->rcTitleBar, -UserGetSystemMetrics(SM_CXEDGE), -UserGetSystemMetrics(SM_CYEDGE)); + RECTL_vInflateRect (&bti->rcTitleBar, -UserGetSystemMetrics(SM_CXEDGE), -UserGetSystemMetrics(SM_CYEDGE)); } if (dwExStyle & WS_EX_STATICEDGE) { /* FIXME : Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXBORDER) and UserGetSystemMetrics(SM_CYBORDER) */ - co_InflateRect (&bti->rcTitleBar, -UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER)); + RECTL_vInflateRect (&bti->rcTitleBar, -UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER)); } } } diff --git a/subsystems/win32/win32k/ntuser/timer.c b/subsystems/win32/win32k/ntuser/timer.c index da114f81b5f..fdfddc667ec 100644 --- a/subsystems/win32/win32k/ntuser/timer.c +++ b/subsystems/win32/win32k/ntuser/timer.c @@ -368,7 +368,8 @@ ProcessTimers(VOID) { if (pTmr->cmsCountdown < 0) { - if (!(pTmr->flags & TMRF_READY)) + ASSERT(pTmr->pti); + if ((!(pTmr->flags & TMRF_READY)) && (!(pTmr->pti->TIF_flags & TIF_INCLEANUP))) { if (pTmr->flags & TMRF_ONESHOT) pTmr->flags |= TMRF_WAITING; @@ -384,8 +385,8 @@ ProcessTimers(VOID) // Set thread message queue for this timer. if (pTmr->pti->MessageQueue) { // Wakeup thread - if (pTmr->pti->MessageQueue->WakeMask & QS_POSTMESSAGE) - KeSetEvent(pTmr->pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); + ASSERT(pTmr->pti->MessageQueue->NewMessages != NULL); + KeSetEvent(pTmr->pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); } } } diff --git a/subsystems/win32/win32k/ntuser/window.c b/subsystems/win32/win32k/ntuser/window.c index f22c6dce047..526b15ac515 100644 --- a/subsystems/win32/win32k/ntuser/window.c +++ b/subsystems/win32/win32k/ntuser/window.c @@ -1998,14 +1998,16 @@ AllocErr: else dwExStyle &= ~WS_EX_WINDOWEDGE; + Wnd->style = dwStyle & ~WS_VISIBLE; + /* Correct the window style. */ - if (!(dwStyle & WS_CHILD)) + if ((Wnd->style & (WS_CHILD | WS_POPUP)) != WS_CHILD) { - dwStyle |= WS_CLIPSIBLINGS; + Wnd->style |= WS_CLIPSIBLINGS; DPRINT("3: Style is now %lx\n", dwStyle); - if (!(dwStyle & WS_POPUP)) + if (!(Wnd->style & WS_POPUP)) { - dwStyle |= WS_CAPTION; + Wnd->style |= WS_CAPTION; Window->state |= WINDOWOBJECT_NEED_SIZE; DPRINT("4: Style is now %lx\n", dwStyle); } @@ -2066,7 +2068,6 @@ AllocErr: Size.cy = nHeight; Wnd->ExStyle = dwExStyle; - Wnd->style = dwStyle & ~WS_VISIBLE; /* call hook */ Cs.lpCreateParams = lpParam; @@ -2099,6 +2100,8 @@ AllocErr: y = Cs.y; nWidth = Cs.cx; nHeight = Cs.cy; + + Cs.style = dwStyle; // FIXME: Need to set the Z order in the window link list if the hook callback changed it! // hwndInsertAfter = CbtCreate.hwndInsertAfter; @@ -2246,11 +2249,6 @@ AllocErr: /* FIXME: Initialize the window menu. */ /* Send a NCCREATE message. */ - Cs.cx = Size.cx; - Cs.cy = Size.cy; - Cs.x = Pos.x; - Cs.y = Pos.y; - DPRINT("[win32k.window] IntCreateWindowEx style %d, exstyle %d, parent %d\n", Cs.style, Cs.dwExStyle, Cs.hwndParent); DPRINT("IntCreateWindowEx(): (%d,%d-%d,%d)\n", x, y, Size.cx, Size.cy); DPRINT("IntCreateWindowEx(): About to send NCCREATE message.\n"); diff --git a/subsystems/win32/win32k/ntuser/winpos.c b/subsystems/win32/win32k/ntuser/winpos.c index 6b5b0d9d6f6..0ed7e248f2c 100644 --- a/subsystems/win32/win32k/ntuser/winpos.c +++ b/subsystems/win32/win32k/ntuser/winpos.c @@ -400,36 +400,120 @@ co_WinPosMinMaximize(PWINDOW_OBJECT Window, UINT ShowFlag, RECT* NewPos) return(SwpFlags); } +BOOL +UserHasWindowEdge(DWORD Style, DWORD ExStyle) +{ + if (Style & WS_MINIMIZE) + return TRUE; + if (ExStyle & WS_EX_DLGMODALFRAME) + return TRUE; + if (ExStyle & WS_EX_STATICEDGE) + return FALSE; + if (Style & WS_THICKFRAME) + return TRUE; + Style &= WS_CAPTION; + if (Style == WS_DLGFRAME || Style == WS_CAPTION) + return TRUE; + return FALSE; +} + +VOID +UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient) +{ + DWORD Border = 0; + + if (UserHasWindowEdge(Style, ExStyle)) + Border += 2; + else if (ExStyle & WS_EX_STATICEDGE) + Border += 1; + if ((ExStyle & WS_EX_CLIENTEDGE) && WithClient) + Border += 2; + if (Style & WS_CAPTION || ExStyle & WS_EX_DLGMODALFRAME) + Border ++; + Size->cx = Size->cy = Border; + if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE)) + { + Size->cx += UserGetSystemMetrics(SM_CXFRAME) - UserGetSystemMetrics(SM_CXDLGFRAME); + Size->cy += UserGetSystemMetrics(SM_CYFRAME) - UserGetSystemMetrics(SM_CYDLGFRAME); + } + Size->cx *= UserGetSystemMetrics(SM_CXBORDER); + Size->cy *= UserGetSystemMetrics(SM_CYBORDER); +} + +BOOL WINAPI +UserAdjustWindowRectEx(LPRECT lpRect, + DWORD dwStyle, + BOOL bMenu, + DWORD dwExStyle) +{ + SIZE BorderSize; + + if (bMenu) + { + lpRect->top -= UserGetSystemMetrics(SM_CYMENU); + } + if ((dwStyle & WS_CAPTION) == WS_CAPTION) + { + if (dwExStyle & WS_EX_TOOLWINDOW) + lpRect->top -= UserGetSystemMetrics(SM_CYSMCAPTION); + else + lpRect->top -= UserGetSystemMetrics(SM_CYCAPTION); + } + UserGetWindowBorders(dwStyle, dwExStyle, &BorderSize, TRUE); + RECTL_vInflateRect( + lpRect, + BorderSize.cx, + BorderSize.cy); + + return TRUE; +} + static VOID FASTCALL WinPosFillMinMaxInfoStruct(PWINDOW_OBJECT Window, MINMAXINFO *Info) { - UINT XInc, YInc; - RECTL WorkArea; - PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PDESKTOP Desktop = pti->rpdesk; /* Or rather get it from the window? */ + INT xinc, yinc; + LONG style = Window->Wnd->style; + LONG adjustedStyle; + LONG exstyle = Window->Wnd->ExStyle; + RECT rc; - IntGetDesktopWorkArea(Desktop, &WorkArea); + /* Compute default values */ - /* Get default values. */ - Info->ptMinTrackSize.x = UserGetSystemMetrics(SM_CXMINTRACK); - Info->ptMinTrackSize.y = UserGetSystemMetrics(SM_CYMINTRACK); + rc = Window->Wnd->rcWindow; + Info->ptReserved.x = rc.left; + Info->ptReserved.y = rc.top; - IntGetWindowBorderMeasures(Window, &XInc, &YInc); - Info->ptMaxSize.x = WorkArea.right - WorkArea.left + 2 * XInc; - Info->ptMaxSize.y = WorkArea.bottom - WorkArea.top + 2 * YInc; - Info->ptMaxTrackSize.x = Info->ptMaxSize.x; - Info->ptMaxTrackSize.y = Info->ptMaxSize.y; + if ((style & WS_CAPTION) == WS_CAPTION) + adjustedStyle = style & ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */ + else + adjustedStyle = style; - if (Window->Wnd->InternalPosInitialized) - { - Info->ptMaxPosition = Window->Wnd->InternalPos.MaxPos; - } - else - { - Info->ptMaxPosition.x = WorkArea.left - XInc; - Info->ptMaxPosition.y = WorkArea.top - YInc; - } + if(Window->Wnd->spwndParent) + IntGetClientRect(Window->spwndParent, &rc); + UserAdjustWindowRectEx(&rc, adjustedStyle, ((style & WS_POPUP) && Window->Wnd->IDMenu), exstyle); + + xinc = -rc.left; + yinc = -rc.top; + + Info->ptMaxSize.x = rc.right - rc.left; + Info->ptMaxSize.y = rc.bottom - rc.top; + if (style & (WS_DLGFRAME | WS_BORDER)) + { + Info->ptMinTrackSize.x = UserGetSystemMetrics(SM_CXMINTRACK); + Info->ptMinTrackSize.y = UserGetSystemMetrics(SM_CYMINTRACK); + } + else + { + Info->ptMinTrackSize.x = 2 * xinc; + Info->ptMinTrackSize.y = 2 * yinc; + } + Info->ptMaxTrackSize.x = UserGetSystemMetrics(SM_CXMAXTRACK); + Info->ptMaxTrackSize.y = UserGetSystemMetrics(SM_CYMAXTRACK); + Info->ptMaxPosition.x = -xinc; + Info->ptMaxPosition.y = -yinc; + + //if (!EMPTYPOINT(win->max_pos)) MinMax.ptMaxPosition = win->max_pos; } UINT FASTCALL diff --git a/subsystems/win32/win32k/objects/rect.c b/subsystems/win32/win32k/objects/rect.c index ea58e63f0a9..e3012185ca7 100644 --- a/subsystems/win32/win32k/objects/rect.c +++ b/subsystems/win32/win32k/objects/rect.c @@ -102,5 +102,14 @@ RECTL_vMakeWellOrdered(RECTL *prcl) } } +VOID +FASTCALL +RECTL_vInflateRect(RECTL *rect, INT dx, INT dy) +{ + rect->left -= dx; + rect->top -= dy; + rect->right += dx; + rect->bottom += dy; +} /* EOF */