sync with trunk (r47268)
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 19 May 2010 03:44:15 +0000 (03:44 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 19 May 2010 03:44:15 +0000 (03:44 +0000)
svn path=/branches/reactos-yarotows/; revision=47271

61 files changed:
ReactOS-arm.rbuild
base/applications/rapps/rapps/dosbox.txt
base/applications/rapps/rapps/firefox2.txt
base/applications/rapps/rapps/irfanview.txt
base/applications/rapps/rapps/irfanviewplugins.txt
base/applications/rapps/rapps/rosbe.txt
base/applications/rapps/rapps/utorrent.txt
base/applications/regedit/find.c
base/applications/regedit/lang/bg-BG.rc
base/applications/regedit/lang/cs-CZ.rc
base/applications/regedit/lang/de-DE.rc
base/applications/regedit/lang/el-GR.rc
base/applications/regedit/lang/en-US.rc
base/applications/regedit/lang/es-ES.rc
base/applications/regedit/lang/fr-FR.rc
base/applications/regedit/lang/hu-HU.rc
base/applications/regedit/lang/id-ID.rc
base/applications/regedit/lang/it-IT.rc
base/applications/regedit/lang/ja-JP.rc
base/applications/regedit/lang/ko-KR.rc
base/applications/regedit/lang/nl-NL.rc
base/applications/regedit/lang/no-NO.rc
base/applications/regedit/lang/pl-PL.rc
base/applications/regedit/lang/pt-BR.rc
base/applications/regedit/lang/pt-PT.rc
base/applications/regedit/lang/ru-RU.rc
base/applications/regedit/lang/sk-SK.rc
base/applications/regedit/lang/sl-SI.rc
base/applications/regedit/lang/sv-SE.rc
base/applications/regedit/lang/th-TH.rc
base/applications/regedit/lang/uk-UA.rc
base/applications/regedit/lang/zh-CN.rc
base/applications/regedit/listview.c
base/applications/regedit/regproc.c
base/applications/regedit/regproc.h
boot/bootdata/hivesft_arm.inf
boot/bootdata/hivesft_i386.inf
boot/bootdata/hivesys_i386.inf
dll/win32/kernel32/mem/global.c
dll/win32/kernel32/misc/console.c
dll/win32/kernel32/misc/nls.c
dll/win32/kernel32/misc/utils.c
dll/win32/kernel32/thread/fiber.c
dll/win32/kernel32/thread/i386/fiber.S
dll/win32/qmgr/qmgr.inf
dll/win32/setupapi/install.c
dll/win32/user32/windows/menu.c
dll/win32/user32/windows/window.c
dll/win32/userenv/lang/de-DE.rc
dll/win32/userenv/lang/fr-FR.rc
drivers/network/afd/afd/read.c
hal/halx86/hal_generic.rbuild
hal/halx86/halamd64.rbuild
include/ndk/i386/asm.h
subsystems/win32/csrss/win32csr/conio.c
subsystems/win32/win32k/include/rect.h
subsystems/win32/win32k/ntuser/menu.c
subsystems/win32/win32k/ntuser/timer.c
subsystems/win32/win32k/ntuser/window.c
subsystems/win32/win32k/ntuser/winpos.c
subsystems/win32/win32k/objects/rect.c

index 6d7abe7..29bddc9 100644 (file)
@@ -74,6 +74,9 @@
                <directory name="inflib">
                        <xi:include href="lib/inflib/inflib.rbuild" />
                </directory>
+               <directory name="newinflib">
+                       <xi:include href="lib/newinflib/inflib.rbuild" />
+               </directory>
                <directory name="cmlib">
                        <xi:include href="lib/cmlib/cmlib.rbuild" />
                </directory>
index 783779d..7a25f08 100644 (file)
@@ -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]
index 0c63794..3cf7dc2 100644 (file)
@@ -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
index 9f1d574..c392d1e 100644 (file)
@@ -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]
index 9d36ab8..fc7ab23 100644 (file)
@@ -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]
index 7d7918b..384df84 100644 (file)
@@ -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]
index ffcded7..f987811 100644 (file)
@@ -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
 
 
index d718007..e20d016 100644 (file)
@@ -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;
+
+    if (_tcslen(s_szFindWhat) == 0)
+    {
+        FindDialog(hWnd);
+        return TRUE;
+    }
 
-    pszFindWhat = s_szFindWhat;
-    dwFlags = GetFindFlags() & ~(RSF_LOOKATVALUES | RSF_LOOKATDATA);
+    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);
+        }
     }
 }
 
index 16c3f5e..c7bd421 100644 (file)
@@ -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
 
index 8376b26..8f36dad 100644 (file)
@@ -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
 
index 2b0a22c..3b2b646 100644 (file)
@@ -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
 
index bb8f6bb..34e4202 100644 (file)
@@ -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
 
index 5bc1ca6..b7e948f 100644 (file)
@@ -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
 
index 48db017..b7e7030 100644 (file)
@@ -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
 
index 3ee1d3b..ed99742 100644 (file)
@@ -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
 
index a59356e..3c7277b 100644 (file)
@@ -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
 
index 4f602ff..c6b9bb1 100644 (file)
@@ -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
 
index c5f2749..47960b8 100644 (file)
@@ -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
 
index 25c8a04..3108fb8 100644 (file)
@@ -423,9 +423,9 @@ BEGIN
     CONTROL         "\83f\81[\83^(&D)",IDC_LOOKAT_DATA,"Button",BS_AUTOCHECKBOX |
                     WS_TABSTOP,14,60,42,8
     CONTROL         "\8a®\91S\82É\88ê\92v\82·\82é\82à\82Ì\82¾\82¯\82ð\8c\9f\8dõ(&W)",IDC_MATCHSTRING,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,83,32,94,13
+                    BS_AUTOCHECKBOX | WS_TABSTOP,83,32,109,13
     CONTROL         "\91å\95\8e\9a\82Æ\8f¬\95\8e\9a\82ð\8bæ\95Ê\82·\82é(&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      "\83L\83\83\83\93\83Z\83\8b(&C)",IDCANCEL,93,29,45,14
+    DEFPUSHBUTTON   "\83L\83\83\83\93\83Z\83\8b(&C)",IDCANCEL,93,29,45,14
     LTEXT           "\83\8c\83W\83X\83g\83\8a\82Ì\8c\9f\8dõ\92\86...",IDC_STATIC,33,12,83,8
 END
 
index b4bd99c..5aef6a1 100644 (file)
@@ -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
 
index 0596b96..158a4ec 100644 (file)
@@ -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
 
index 4d5073e..ac3e7fa 100644 (file)
@@ -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           "Søker i registret...",IDC_STATIC,33,12,83,8
 END
 
index bfa9294..ebf6da0 100644 (file)
@@ -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
 
index 4d26aae..9c1f724 100644 (file)
@@ -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
 
index 5f2806d..081ba3b 100644 (file)
@@ -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
 
index e14ec89..3d38ed2 100644 (file)
@@ -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
 
index b1a8cf6..1ef4df9 100644 (file)
@@ -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      "&Zru\9ai\9d",IDCANCEL,93,29,45,14
+    DEFPUSHBUTTON   "&Zru\9ai\9d",IDCANCEL,93,29,45,14
     LTEXT           "Searching the registry...",IDC_STATIC,33,12,83,8
 END
 
index 356d084..5c529ff 100644 (file)
@@ -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
 
index 09c0663..efce60a 100644 (file)
@@ -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
 
index 72220f9..d69da60 100644 (file)
@@ -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
 
index ff7d139..e7d53f0 100644 (file)
@@ -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
 
index 875aff1..87a1e6f 100644 (file)
@@ -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
 
index 64a6e12..6e95a86 100644 (file)
@@ -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);
 
index c67e05d..2ba45c2 100644 (file)
@@ -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
  */
index 15bb248..aae3a4a 100644 (file)
@@ -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 */
index a3a273f..aabd6e1 100644 (file)
@@ -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
index 006796e..b65d55a 100644 (file)
@@ -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
index 7cc0db1..8c2bb4f 100644 (file)
@@ -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
 
index 9537cbc..f2cfca5 100644 (file)
@@ -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);
-
-    /* Make sure it's valid */
-    if (!BaseHeapValidateEntry(HandleEntry))
+    _SEH2_TRY
     {
-        /* It's not, fail */
-        BASE_TRACE_FAILURE();
-        SetLastError(ERROR_INVALID_HANDLE);
-        Ptr = NULL;
-    }
-    else
-    {
-        /* Otherwise, get the pointer */
-        Ptr = HandleEntry->Object;
-        if (Ptr)
+        /* Get the handle entry */
+        HandleEntry = BaseHeapGetEntry(hMem);
+        BASE_TRACE_HANDLE(HandleEntry, hMem);
+
+        /* 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 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);
+            }
+        }
 
-        /* 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))
-    {
-        /* It's not, fail */
-        BASE_TRACE_FAILURE();
-        SetLastError(ERROR_INVALID_HANDLE);
-        RetVal = FALSE;
-    }
-    else
+    _SEH2_TRY
     {
-        /* Otherwise, decrement lock count, unless we're already at 0*/
-        if (!HandleEntry->LockCount--)
+        /* Make sure it's valid */
+        if (!BaseHeapValidateEntry(HandleEntry))
         {
-            /* In which case we simply lock it back and fail */
-            HandleEntry->LockCount++;
-            SetLastError(ERROR_NOT_LOCKED);
+            /* It's not, fail */
+            BASE_TRACE_FAILURE();
+            SetLastError(ERROR_INVALID_HANDLE);
             RetVal = FALSE;
         }
-        else if (!HandleEntry->LockCount)
+        else
         {
-            /* Nothing to unlock */
-            SetLastError(NO_ERROR);
-            RetVal = FALSE;
+            /* 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);
index 7ead208..594b8ac 100644 (file)
@@ -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);
     }
index 58a5b81..4e08201 100644 (file)
@@ -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))
index cebd500..04fde77 100644 (file)
@@ -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 */
     {
index 656bc6e..6ba2016 100644 (file)
@@ -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
index cf8bbe0..57358ff 100644 (file)
@@ -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 */
index ef51f9b..c3d0380 100644 (file)
@@ -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"
index a89081c..0d1fd06 100644 (file)
@@ -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 );
index 1178558..d5723bb 100644 (file)
@@ -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)
     {
index 6ed38cc..2aa01a9 100644 (file)
@@ -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.
index 3c28dc6..8795fd9 100644 (file)
@@ -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
index e95f2b0..a3baf6e 100644 (file)
@@ -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
index 3c6ddaa..dccfa55 100644 (file)
@@ -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;
index 8dd5f7b..3532d00 100644 (file)
                        </if>
                        <if property="ARCH" value="amd64">
                                <define name="_X86BIOS_" />
-                               <include base="x86emu">.</include>
+                               <!-- include base="x86emu">.</include -->
                                <directory name="amd64">
                                        <file>x86bios.c</file>
-                                       <file>halinit.c</file>
-                                       <file>irq.S</file>
-                                       <file>misc.c</file>
-                                       <file>apic.c</file>
+                                       <!-- file>halinit.c</file -->
+                                       <!-- file>irq.S</file -->
+                                       <!-- file>misc.c</file -->
+                                       <!-- file>apic.c</file -->
                                        <file>systimer.S</file>
-                                       <file>usage.c</file>
+                                       <!-- file>usage.c</file -->
                                </directory>
                        </if>
                </directory>
index ad96c0f..92c4f29 100644 (file)
@@ -13,7 +13,7 @@
        <library>hal_generic</library>
        <library>hal_generic_acpi</library>
        <library>ntoskrnl</library>
-       <library>x86emu</library>
+       <!-- library>x86emu</library -->
 
        <directory name="generic">
                <file>spinlock.c</file>
index eaaf2ae..f545294 100644 (file)
@@ -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
index 6206a53..493ac17 100644 (file)
 #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;
             }
index 156dd55..e24bc4b 100644 (file)
@@ -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);
index 3b1cd6a..4da4922 100644 (file)
@@ -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));
                 }
             }
         }
index da114f8..fdfddc6 100644 (file)
@@ -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);
                 }
              }
           }
index f22c6dc..526b15a 100644 (file)
@@ -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");
index 6b5b0d9..0ed7e24 100644 (file)
@@ -400,36 +400,120 @@ co_WinPosMinMaximize(PWINDOW_OBJECT Window, UINT ShowFlag, RECT* NewPos)
    return(SwpFlags);
 }
 
-static
-VOID FASTCALL
-WinPosFillMinMaxInfoStruct(PWINDOW_OBJECT Window, MINMAXINFO *Info)
+BOOL
+UserHasWindowEdge(DWORD Style, DWORD ExStyle)
 {
-   UINT XInc, YInc;
-   RECTL WorkArea;
-   PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
-   PDESKTOP Desktop = pti->rpdesk; /* Or rather get it from the window? */
-
-   IntGetDesktopWorkArea(Desktop, &WorkArea);
+   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;
+}
 
-   /* Get default values. */
-   Info->ptMinTrackSize.x = UserGetSystemMetrics(SM_CXMINTRACK);
-   Info->ptMinTrackSize.y = UserGetSystemMetrics(SM_CYMINTRACK);
+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);
+}
 
-   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;
+BOOL WINAPI
+UserAdjustWindowRectEx(LPRECT lpRect,
+                       DWORD dwStyle,
+                       BOOL bMenu,
+                       DWORD dwExStyle)
+{
+   SIZE BorderSize;
 
-   if (Window->Wnd->InternalPosInitialized)
+   if (bMenu)
    {
-      Info->ptMaxPosition = Window->Wnd->InternalPos.MaxPos;
+      lpRect->top -= UserGetSystemMetrics(SM_CYMENU);
    }
-   else
+   if ((dwStyle & WS_CAPTION) == WS_CAPTION)
    {
-      Info->ptMaxPosition.x = WorkArea.left - XInc;
-      Info->ptMaxPosition.y = WorkArea.top - YInc;
+      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)
+{
+    INT xinc, yinc;
+    LONG style = Window->Wnd->style;
+    LONG adjustedStyle;
+    LONG exstyle = Window->Wnd->ExStyle;
+    RECT rc;
+
+    /* Compute default values */
+
+    rc = Window->Wnd->rcWindow;
+    Info->ptReserved.x = rc.left;
+    Info->ptReserved.y = rc.top;
+
+    if ((style & WS_CAPTION) == WS_CAPTION)
+        adjustedStyle = style & ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */
+    else
+        adjustedStyle = style;
+
+    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
index ea58e63..e301218 100644 (file)
@@ -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 */