Delete "ghost" old(*) files that have been mysteriously added back during the SVN...
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Wed, 4 Oct 2017 01:05:47 +0000 (03:05 +0200)
committerHermès BÉLUSCA - MAÏTO <hermes.belusca@sfr.fr>
Wed, 4 Oct 2017 08:28:36 +0000 (10:28 +0200)
To check that these changes are correct, checkout in a directory (let's call it "ros_svn") the /trunk/reactos/ of our read-only SVN repo r76032 and in /trunk/reactos/modules/, the rosapps, rostests and wallpapers.
In a second directory (let's call it "ros_git"), clone the corresponding Git-converted ReactOS directory.
Before applying this patch (and the previous one that added back the empty directories), you should see additional files in ros_git that are not in ros_svn, corresponding to these files I'm deleting here (plus some .gitignore files),
and you should also see additional files in ros_svn that do not appear in ros_git: these are the empty directories I've restored in my previous patch.

Now, after the application of both the previous patch that restores the empty directories (and deletes the .gitignore files), and this patch that removes the ghost files, you should only see that the only differences
between ros_git and ros_svn are the extra .keep files in the empty directories, and that's all!

Command-line for the tests:
diff --strip-trailing-cr -r ros_svn ros_git > diff_svn2git.txt

"-r" means recursive, and "--strip-trailing-cr" ignores the CR-LF vs. LF (or CR) EOLs.

(*): by "ghost" old(*) files I understand files that existed previously in the far past, that then were deleted long ago in SVN, and that popped out back during the Git migration.

151 files changed:
base/applications/mscutils/devmgmt/about.c [deleted file]
base/applications/mscutils/devmgmt/enumdevices.c [deleted file]
base/applications/mscutils/devmgmt/lang/bg-BG.rc [deleted file]
base/applications/mscutils/devmgmt/lang/cs-CZ.rc [deleted file]
base/applications/mscutils/devmgmt/lang/de-DE.rc [deleted file]
base/applications/mscutils/devmgmt/lang/el-GR.rc [deleted file]
base/applications/mscutils/devmgmt/lang/en-US.rc [deleted file]
base/applications/mscutils/devmgmt/lang/es-ES.rc [deleted file]
base/applications/mscutils/devmgmt/lang/fr-FR.rc [deleted file]
base/applications/mscutils/devmgmt/lang/he-IL.rc [deleted file]
base/applications/mscutils/devmgmt/lang/id-ID.rc [deleted file]
base/applications/mscutils/devmgmt/lang/it-IT.rc [deleted file]
base/applications/mscutils/devmgmt/lang/ja-JP.rc [deleted file]
base/applications/mscutils/devmgmt/lang/ko-KR.rc [deleted file]
base/applications/mscutils/devmgmt/lang/no-NO.rc [deleted file]
base/applications/mscutils/devmgmt/lang/pl-PL.rc [deleted file]
base/applications/mscutils/devmgmt/lang/pt-BR.rc [deleted file]
base/applications/mscutils/devmgmt/lang/ro-RO.rc [deleted file]
base/applications/mscutils/devmgmt/lang/ru-RU.rc [deleted file]
base/applications/mscutils/devmgmt/lang/sk-SK.rc [deleted file]
base/applications/mscutils/devmgmt/lang/sq-AL.rc [deleted file]
base/applications/mscutils/devmgmt/lang/sv-SE.rc [deleted file]
base/applications/mscutils/devmgmt/lang/th-TH.rc [deleted file]
base/applications/mscutils/devmgmt/lang/tr-TR.rc [deleted file]
base/applications/mscutils/devmgmt/lang/uk-UA.rc [deleted file]
base/applications/mscutils/devmgmt/lang/zh-CN.rc [deleted file]
base/applications/mscutils/devmgmt/mainwnd.c [deleted file]
base/applications/mscutils/devmgmt/misc.c [deleted file]
base/applications/mscutils/devmgmt/precomp.h [deleted file]
base/applications/mscutils/devmgmt/res/computer.ico [deleted file]
base/applications/mscutils/devmgmt/res/exit.bmp [deleted file]
base/applications/mscutils/devmgmt/res/help.bmp [deleted file]
base/applications/mscutils/devmgmt/res/properties.bmp [deleted file]
base/applications/mscutils/devmgmt/res/refresh.bmp [deleted file]
base/applications/mscutils/devmgmt/res/root.bmp [deleted file]
base/applications/mscutils/devmgmt/resource.h [deleted file]
base/applications/rapps/aboutdlg.c [deleted file]
base/applications/rapps/available.c [deleted file]
base/applications/rapps/installdlg.c [deleted file]
base/applications/rapps/installed.c [deleted file]
base/applications/rapps/listview.c [deleted file]
base/applications/rapps/loaddlg.c [deleted file]
base/applications/rapps/misc.c [deleted file]
base/applications/rapps/richedit.c [deleted file]
base/applications/rapps/settingsdlg.c [deleted file]
base/applications/rapps/splitter.c [deleted file]
base/applications/rapps/statusbar.c [deleted file]
base/applications/rapps/toolbar.c [deleted file]
base/applications/rapps/treeview.c [deleted file]
base/applications/rapps/winmain.c [deleted file]
dll/opengl/opengl32/font.c [deleted file]
dll/opengl/opengl32/gl.c [deleted file]
dll/opengl/opengl32/icdlist.h [deleted file]
dll/opengl/opengl32/icdtable.h [deleted file]
dll/opengl/opengl32/opengl32.c [deleted file]
dll/opengl/opengl32/opengl32.dsp [deleted file]
dll/opengl/opengl32/opengl32.dsw [deleted file]
dll/win32/devmgr/advprop.c [deleted file]
dll/win32/devmgr/devmgmt/Resource.h [deleted file]
dll/win32/devmgr/devmgmt/lang/de-DE.rc [deleted file]
dll/win32/devmgr/devmgmt/lang/en-US.rc [deleted file]
dll/win32/devmgr/devmgmt/lang/ru-RU.rc [deleted file]
dll/win32/devmgr/devmgmt/lang/tr-TR.rc [deleted file]
dll/win32/devmgr/devmgmt/res/computer.ico [deleted file]
dll/win32/devmgr/devmgmt/res/root.bmp [deleted file]
dll/win32/devmgr/devmgmt/res/toolbar.bmp [deleted file]
dll/win32/devmgr/devmgmt/rsrc.rc [deleted file]
dll/win32/devmgr/devmgmt/stdafx.h [deleted file]
dll/win32/devmgr/devprblm.c [deleted file]
dll/win32/devmgr/hwpage.c [deleted file]
dll/win32/devmgr/hwresource.c [deleted file]
dll/win32/devmgr/misc.c [deleted file]
dll/win32/devmgr/resources/devmgr.ico [deleted file]
dll/win32/devmgr/stubs.c [deleted file]
dll/win32/ws2_32/include/catalog.h [deleted file]
dll/win32/ws2_32/include/debug.h [deleted file]
dll/win32/ws2_32/include/handle.h [deleted file]
dll/win32/ws2_32/include/upcall.h [deleted file]
dll/win32/ws2_32/include/ws2_32.h [deleted file]
dll/win32/ws2_32/misc/bsd.c [deleted file]
dll/win32/ws2_32/misc/catalog.c [deleted file]
dll/win32/ws2_32/misc/dllmain.c [deleted file]
dll/win32/ws2_32/misc/event.c [deleted file]
dll/win32/ws2_32/misc/handle.c [deleted file]
dll/win32/ws2_32/misc/ns.c [deleted file]
dll/win32/ws2_32/misc/sndrcv.c [deleted file]
dll/win32/ws2_32/misc/stubs.c [deleted file]
dll/win32/ws2_32/misc/upcall.c [deleted file]
dll/win32/ws2_32/tests/setup.c [deleted file]
dll/win32/ws2_32/tests/stubs.tst [deleted file]
dll/win32/ws2_32/tests/tests/WinsockEvent.c [deleted file]
dll/win32/ws2_32/wine/async.c [deleted file]
dll/win32/ws2_32/wine/socket.c [deleted file]
drivers/base/kdcom/arm/kdbg.c [deleted file]
drivers/base/kdcom/i386/kdbg.c [deleted file]
drivers/filesystems/ext2/inc/errmsg.h [deleted file]
drivers/filesystems/ext2/inc/ext2_fs.h [deleted file]
drivers/filesystems/ext2/inc/ext2fsd.h [deleted file]
drivers/filesystems/ext2/inc/ext2metadata.h [deleted file]
drivers/filesystems/ext2/inc/protos.h [deleted file]
drivers/filesystems/ext2/inc/struct.h [deleted file]
drivers/filesystems/ext2/src/DiskIO.c [deleted file]
drivers/filesystems/ext2/src/devcntrl.c [deleted file]
drivers/filesystems/ext2/src/dircntrl.c [deleted file]
drivers/filesystems/ext2/src/ext2init.c [deleted file]
drivers/filesystems/ext2/src/fsctrl.c [deleted file]
drivers/filesystems/ext2/src/io.c [deleted file]
drivers/filesystems/ext2/src/metadata.c [deleted file]
drivers/filesystems/npfs/dirctl.c [deleted file]
drivers/filesystems/npfs/finfo.c [deleted file]
drivers/filesystems/npfs/npfs.c [deleted file]
drivers/filesystems/npfs/rw.c [deleted file]
drivers/filesystems/npfs/volume.c [deleted file]
drivers/multimedia/portcls.NEW/adapter.c [deleted file]
drivers/multimedia/portcls.NEW/dll.c [deleted file]
drivers/multimedia/portcls.NEW/drm.c [deleted file]
drivers/multimedia/portcls.NEW/portcls.c [deleted file]
drivers/multimedia/portcls.NEW/portcls.def [deleted file]
drivers/multimedia/portcls.NEW/portcls.h [deleted file]
drivers/multimedia/portcls.NEW/portcls.rbuild [deleted file]
drivers/multimedia/portcls.NEW/portcls.rc [deleted file]
drivers/multimedia/portcls.NEW/stubs.c [deleted file]
drivers/multimedia/x/allocators.c [deleted file]
drivers/multimedia/x/clocks.c [deleted file]
drivers/multimedia/x/connectivity.c [deleted file]
drivers/multimedia/x/events.c [deleted file]
drivers/multimedia/x/irp.c [deleted file]
drivers/multimedia/x/ks.def [deleted file]
drivers/multimedia/x/ks.rbuild [deleted file]
drivers/multimedia/x/ks.rc [deleted file]
drivers/multimedia/x/methods.c [deleted file]
drivers/multimedia/x/misc.c [deleted file]
drivers/multimedia/x/properties.c [deleted file]
drivers/multimedia/x/topology.c [deleted file]
drivers/multimedia/x/worker.c [deleted file]
drivers/usb/usbehci/common.c [deleted file]
drivers/usb/usbehci/fdo.c [deleted file]
drivers/usb/usbehci/hardware.c [deleted file]
drivers/usb/usbehci/hwiface.c [deleted file]
drivers/usb/usbehci/hwiface.h [deleted file]
drivers/usb/usbehci/irp.c [deleted file]
drivers/usb/usbehci/misc.c [deleted file]
drivers/usb/usbehci/pdo.c [deleted file]
drivers/usb/usbehci/physmem.c [deleted file]
drivers/usb/usbehci/physmem.h [deleted file]
drivers/usb/usbehci/transfer.c [deleted file]
drivers/usb/usbehci/transfer.h [deleted file]
drivers/usb/usbehci/usbehci.c [deleted file]
drivers/usb/usbehci/usbiffn.c [deleted file]
drivers/usb/usbehci/usbiffn.h [deleted file]
drivers/usb/usbhub/createclose.c [deleted file]

diff --git a/base/applications/mscutils/devmgmt/about.c b/base/applications/mscutils/devmgmt/about.c
deleted file mode 100644 (file)
index 03fbf8b..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * PROJECT:     ReactOS Device Managment
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        base/applications/mscutils/devmgmt/about.c
- * PURPOSE:     About dialog box message handler
- * COPYRIGHT:   Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
- *
- */
-
-#include "precomp.h"
-
-INT_PTR CALLBACK
-AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
-{
-    HWND  hLicenseEditWnd;
-    HICON hIcon = NULL;
-    TCHAR strLicense[700];
-
-    switch (message)
-    {
-    case WM_INITDIALOG:
-
-        hIcon = (HICON)LoadImage(hInstance,
-                                 MAKEINTRESOURCE(IDI_MAIN_ICON),
-                                 IMAGE_ICON,
-                                 16,
-                                 16,
-                                 0);
-
-        SendMessage(hDlg,
-                    WM_SETICON,
-                    ICON_SMALL,
-                    (LPARAM)hIcon);
-
-        hLicenseEditWnd = GetDlgItem(hDlg,
-                                     IDC_LICENSE_EDIT);
-
-        LoadString(hInstance,
-                   IDS_LICENSE,
-                   strLicense,
-                   sizeof(strLicense) / sizeof(TCHAR));
-
-        SetWindowText(hLicenseEditWnd,
-                      strLicense);
-
-        return TRUE;
-
-    case WM_COMMAND:
-
-        if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
-        {
-            DestroyIcon(hIcon);
-            EndDialog(hDlg,
-                      LOWORD(wParam));
-            return TRUE;
-        }
-
-        break;
-    }
-
-    return FALSE;
-}
diff --git a/base/applications/mscutils/devmgmt/enumdevices.c b/base/applications/mscutils/devmgmt/enumdevices.c
deleted file mode 100644 (file)
index a19b43c..0000000
+++ /dev/null
@@ -1,688 +0,0 @@
-/*
- * PROJECT:     ReactOS Device Managment
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        base/applications/mscutils/devmgmt/enumdevices.c
- * PURPOSE:     Enumerates all devices on the local machine
- * COPYRIGHT:   Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
- *
- */
-
-#include "precomp.h"
-
-#include <cfgmgr32.h>
-#include <dll/devmgr/devmgr.h>
-#include <initguid.h>
-#include <devguid.h>
-
-static SP_CLASSIMAGELIST_DATA ImageListData;
-
-
-VOID
-FreeDeviceStrings(HWND hTreeView)
-{
-    HTREEITEM hItem;
-
-    hItem = TreeView_GetRoot(hTreeView);
-
-    if (hItem)
-    {
-        hItem = TreeView_GetChild(hTreeView,
-                                  hItem);
-        /* loop the parent items */
-        while (hItem)
-        {
-            hItem = TreeView_GetChild(hTreeView,
-                                      hItem);
-            if (hItem == NULL)
-                break;
-
-            /* loop the child items and free the DeviceID */
-            while (TRUE)
-            {
-                HTREEITEM hOldItem;
-                TV_ITEM tvItem;
-                //TCHAR Buf[100];
-
-                tvItem.hItem = hItem;
-                tvItem.mask = TVIF_PARAM;// | TVIF_TEXT;
-                //tvItem.pszText = Buf;
-                //tvItem.cchTextMax = 99;
-
-                (void)TreeView_GetItem(hTreeView, &tvItem);
-
-                //MessageBox(NULL, Buf, NULL, 0);
-
-                HeapFree(GetProcessHeap(),
-                         0,
-                         (LPTSTR)tvItem.lParam);
-
-                hOldItem = hItem;
-
-                hItem = TreeView_GetNextSibling(hTreeView,
-                                                hItem);
-                if (hItem == NULL)
-                {
-                    hItem = hOldItem;
-                    break;
-                }
-            }
-
-            hItem = TreeView_GetParent(hTreeView,
-                                       hItem);
-            hItem = TreeView_GetNextSibling(hTreeView,
-                                            hItem);
-        }
-    }
-}
-
-
-VOID
-OpenPropSheet(HWND hTreeView,
-              HTREEITEM hItem)
-{
-    TV_ITEM tvItem;
-
-    tvItem.hItem = hItem;
-    tvItem.mask = TVIF_PARAM;
-
-    if (TreeView_GetItem(hTreeView, &tvItem) &&
-        (LPTSTR)tvItem.lParam != NULL)
-    {
-        DevicePropertiesExW(hTreeView,
-                            NULL,
-                            (LPTSTR)tvItem.lParam,
-                            DPF_EXTENDED,
-                            FALSE);
-    }
-}
-
-
-static HTREEITEM
-InsertIntoTreeView(HWND hTreeView,
-                   HTREEITEM hRoot,
-                   LPTSTR lpLabel,
-                   LPTSTR DeviceID,
-                   INT DevImage,
-                   UINT OverlayImage)
-{
-    TV_ITEM tvi;
-    TV_INSERTSTRUCT tvins;
-
-    ZeroMemory(&tvi, sizeof(tvi));
-    ZeroMemory(&tvins, sizeof(tvins));
-
-    tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
-    tvi.pszText = lpLabel;
-    tvi.cchTextMax = lstrlen(lpLabel);
-    tvi.lParam = (LPARAM)DeviceID;
-    tvi.iImage = DevImage;
-    tvi.iSelectedImage = DevImage;
-
-    if (OverlayImage != 0)
-    {
-        tvi.mask |= TVIF_STATE;
-        tvi.stateMask = TVIS_OVERLAYMASK;
-        tvi.state = INDEXTOOVERLAYMASK(OverlayImage);
-    }
-
-    tvins.item = tvi;
-    tvins.hParent = hRoot;
-
-    return TreeView_InsertItem(hTreeView, &tvins);
-}
-
-
-static
-ULONG
-GetClassCount(VOID)
-{
-    ULONG ulClassIndex;
-    GUID ClassGuid;
-    CONFIGRET cr;
-
-    for (ulClassIndex = 0; ; ulClassIndex++)
-    {
-        cr = CM_Enumerate_Classes(ulClassIndex,
-                                  &ClassGuid,
-                                  0);
-        if (cr == CR_NO_SUCH_VALUE)
-            return ulClassIndex;
-    }
-}
-
-
-static
-PDEVCLASS_ENTRY
-GetClassFromClassGuid(
-    PDEVCLASS_ENTRY pClassArray,
-    ULONG ulClassCount,
-    GUID *pGuid)
-{
-    PDEVCLASS_ENTRY pClass, pUnknownClass = NULL;
-    ULONG i;
-
-    for (i = 0; i < ulClassCount; i++)
-    {
-        pClass = &pClassArray[i];
-
-        if (IsEqualGUID(&pClass->ClassGuid, &GUID_DEVCLASS_UNKNOWN))
-            pUnknownClass = pClass;
-
-        if (IsEqualGUID(&pClass->ClassGuid, pGuid))
-            return pClass;
-    }
-
-    return pUnknownClass;
-}
-
-
-static
-VOID
-EnumDeviceClasses(
-    HWND hTreeView,
-    HTREEITEM hRoot,
-    PDEVCLASS_ENTRY pClassArray,
-    ULONG ClassCount)
-{
-    WCHAR ClassName[MAX_DEV_LEN];
-    WCHAR ClassDesc[MAX_DEV_LEN];
-    PDEVCLASS_ENTRY pClass;
-    ULONG ClassIndex;
-    DWORD dwSize;
-    LONG lSize;
-    HKEY hKey;
-    CONFIGRET cr;
-
-    for (ClassIndex = 0; ClassIndex < ClassCount; ClassIndex++)
-    {
-        pClass = &pClassArray[ClassIndex];
-
-        cr = CM_Enumerate_Classes(ClassIndex,
-                                  &pClass->ClassGuid,
-                                  0);
-        if (cr == CR_NO_SUCH_VALUE)
-            return;
-
-        dwSize = MAX_CLASS_NAME_LEN;
-        if (!SetupDiClassNameFromGuid(&pClass->ClassGuid,
-                                      ClassName,
-                                      dwSize,
-                                      &dwSize))
-        {
-            ClassName[0] = _T('\0');
-        }
-
-        if (!SetupDiGetClassImageIndex(&ImageListData,
-                                       &pClass->ClassGuid,
-                                       &pClass->ClassImage))
-        {
-            /* FIXME: can we do this?
-             * Set the blank icon: IDI_SETUPAPI_BLANK = 41
-             * it'll be image 24 in the imagelist */
-            pClass->ClassImage = 24;
-        }
-
-        hKey = SetupDiOpenClassRegKeyEx(&pClass->ClassGuid,
-                                        MAXIMUM_ALLOWED,
-                                        DIOCR_INSTALLER,
-                                        NULL,
-                                        0);
-        if (hKey != INVALID_HANDLE_VALUE)
-        {
-            lSize = MAX_DEV_LEN;
-            if (RegQueryValue(hKey,
-                              NULL,
-                              ClassDesc,
-                              &lSize) != ERROR_SUCCESS)
-            {
-                ClassDesc[0] = _T('\0');
-            }
-
-            RegCloseKey(hKey);
-        }
-
-        pClass->hItem = InsertIntoTreeView(hTreeView,
-                                           hRoot,
-                                           (ClassDesc[0] != _T('\0')) ? ClassDesc : ClassName,
-                                           NULL,
-                                           pClass->ClassImage,
-                                           0);
-    }
-}
-
-
-static
-VOID
-EnumDevices(
-    HWND hTreeView,
-    PDEVCLASS_ENTRY pClassArray,
-    ULONG ulClassCount,
-    BOOL bShowHidden)
-{
-    HDEVINFO hDevInfo =  INVALID_HANDLE_VALUE;
-    SP_DEVINFO_DATA DeviceInfoData;
-    ULONG Status, Problem;
-    DWORD DevIdSize;
-    TCHAR DeviceName[MAX_DEV_LEN];
-    DWORD DevIndex;
-    LPTSTR InstanceId;
-    PDEVCLASS_ENTRY pClass;
-    UINT OverlayImage;
-    CONFIGRET cr;
-
-
-    /* Get device info for all devices of a particular class */
-    hDevInfo = SetupDiGetClassDevs(NULL,
-                                   NULL,
-                                   NULL,
-                                   DIGCF_PRESENT | DIGCF_ALLCLASSES);
-    if (hDevInfo == INVALID_HANDLE_VALUE)
-        return;
-
-    for (DevIndex = 0; ; DevIndex++)
-    {
-        ZeroMemory(&DeviceInfoData, sizeof(SP_DEVINFO_DATA));
-        DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
-
-        InstanceId = NULL;
-        DeviceName[0] = _T('\0');
-        OverlayImage = 0;
-
-        if (!SetupDiEnumDeviceInfo(hDevInfo,
-                                   DevIndex,
-                                   &DeviceInfoData))
-            break;
-
-        if (bShowHidden == FALSE &&
-            (IsEqualGUID(&DeviceInfoData.ClassGuid, &GUID_DEVCLASS_LEGACYDRIVER) ||
-             IsEqualGUID(&DeviceInfoData.ClassGuid, &GUID_DEVCLASS_VOLUME)))
-            continue;
-
-        pClass = GetClassFromClassGuid(pClassArray,
-                                       ulClassCount,
-                                       &DeviceInfoData.ClassGuid);
-
-        /* get the device ID */
-        if (!SetupDiGetDeviceInstanceId(hDevInfo,
-                                        &DeviceInfoData,
-                                        NULL,
-                                        0,
-                                        &DevIdSize))
-        {
-            if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
-            {
-                InstanceId = (LPTSTR)HeapAlloc(GetProcessHeap(),
-                                             0,
-                                             DevIdSize * sizeof(TCHAR));
-                if (InstanceId != NULL)
-                {
-                    if (!SetupDiGetDeviceInstanceId(hDevInfo,
-                                                    &DeviceInfoData,
-                                                    InstanceId,
-                                                    DevIdSize,
-                                                    NULL))
-                    {
-                        HeapFree(GetProcessHeap(),
-                                 0,
-                                 InstanceId);
-                        InstanceId = NULL;
-                    }
-                }
-            }
-        }
-
-        /* Skip the root device */
-        if (InstanceId != NULL &&
-            _tcscmp(InstanceId, _T("HTREE\\ROOT\\0")) == 0)
-        {
-            HeapFree(GetProcessHeap(),
-                     0,
-                     InstanceId);
-            InstanceId = NULL;
-            continue;
-        }
-
-        /* Get the device's friendly name */
-        if (!SetupDiGetDeviceRegistryProperty(hDevInfo,
-                                              &DeviceInfoData,
-                                              SPDRP_FRIENDLYNAME,
-                                              0,
-                                              (BYTE*)DeviceName,
-                                              MAX_DEV_LEN,
-                                              NULL))
-        {
-            /* If the friendly name fails, try the description instead */
-            SetupDiGetDeviceRegistryProperty(hDevInfo,
-                                             &DeviceInfoData,
-                                             SPDRP_DEVICEDESC,
-                                             0,
-                                             (BYTE*)DeviceName,
-                                             MAX_DEV_LEN,
-                                             NULL);
-        }
-
-        cr = CM_Get_DevNode_Status_Ex(&Status,
-                                      &Problem,
-                                      DeviceInfoData.DevInst,
-                                      0,
-                                      NULL);
-        if ((cr == CR_SUCCESS) &&
-            (Status & DN_HAS_PROBLEM))
-        {
-            if (Problem == CM_PROB_DISABLED ||
-                Problem == CM_PROB_HARDWARE_DISABLED)
-                OverlayImage = 2;
-            else
-                OverlayImage = 1;
-        }
-
-        InsertIntoTreeView(hTreeView,
-                           pClass->hItem,
-                           DeviceName,
-                           InstanceId,
-                           pClass->ClassImage,
-                           OverlayImage);
-
-        if (OverlayImage != 0)
-        {
-             /* Expand the class if the device has a problem */
-             (void)TreeView_Expand(hTreeView,
-                                   pClass->hItem,
-                                   TVE_EXPAND);
-        }
-
-        pClass->bUsed = TRUE;
-    }
-
-    if (hDevInfo !=  INVALID_HANDLE_VALUE)
-        SetupDiDestroyDeviceInfoList(hDevInfo);
-}
-
-
-static
-VOID
-CleanupDeviceClasses(
-    HWND hTreeView,
-    PDEVCLASS_ENTRY pClassArray,
-    ULONG ulClassCount)
-{
-    PDEVCLASS_ENTRY pClass;
-    ULONG i;
-
-    for (i = 0; i < ulClassCount; i++)
-    {
-        pClass = &pClassArray[i];
-
-        if (pClass->bUsed == FALSE)
-            (void)TreeView_DeleteItem(hTreeView,
-                                      pClass->hItem);
-        else
-            (void)TreeView_SortChildren(hTreeView,
-                                        pClass->hItem,
-                                        0);
-    }
-}
-
-
-VOID
-ListDevicesByType(HWND hTreeView,
-                  HTREEITEM hRoot,
-                  BOOL bShowHidden)
-{
-    PDEVCLASS_ENTRY pClassArray;
-    ULONG ulClassCount;
-
-    ulClassCount = GetClassCount();
-
-    pClassArray = HeapAlloc(GetProcessHeap(),
-                            HEAP_ZERO_MEMORY,
-                            ulClassCount * sizeof(DEVCLASS_ENTRY));
-    if (pClassArray == NULL)
-        return;
-
-    EnumDeviceClasses(hTreeView,
-                      hRoot,
-                      pClassArray,
-                      ulClassCount);
-
-    EnumDevices(hTreeView,
-                pClassArray,
-                ulClassCount,
-                bShowHidden);
-
-    CleanupDeviceClasses(hTreeView,
-                         pClassArray,
-                         ulClassCount);
-
-    if (pClassArray != NULL)
-        HeapFree(GetProcessHeap(), 0, pClassArray);
-
-    (void)TreeView_Expand(hTreeView,
-                          hRoot,
-                          TVE_EXPAND);
-
-    (void)TreeView_SortChildren(hTreeView,
-                                hRoot,
-                                0);
-
-    (void)TreeView_SelectItem(hTreeView,
-                              hRoot);
-}
-
-
-static HTREEITEM
-AddDeviceToTree(HWND hTreeView,
-                HTREEITEM hRoot,
-                DEVINST dnDevInst,
-                BOOL bShowHidden)
-{
-    TCHAR DevName[MAX_DEV_LEN];
-    TCHAR FriendlyName[MAX_DEV_LEN];
-    TCHAR ClassGuidString[MAX_GUID_STRING_LEN];
-    GUID ClassGuid;
-    ULONG ulLength;
-    LPTSTR DeviceID = NULL;
-    INT ClassImage = 24;
-    CONFIGRET cr;
-
-    ulLength = MAX_GUID_STRING_LEN * sizeof(TCHAR);
-    cr = CM_Get_DevNode_Registry_Property(dnDevInst,
-                                          CM_DRP_CLASSGUID,
-                                          NULL,
-                                          ClassGuidString,
-                                          &ulLength,
-                                          0);
-    if (cr == CR_SUCCESS)
-    {
-        pSetupGuidFromString(ClassGuidString, &ClassGuid);
-
-        if (bShowHidden == FALSE &&
-            (IsEqualGUID(&ClassGuid, &GUID_DEVCLASS_LEGACYDRIVER) ||
-             IsEqualGUID(&ClassGuid, &GUID_DEVCLASS_VOLUME)))
-            return NULL;
-    }
-    else
-    {
-        /* It's a device with no driver */
-        ClassGuid = GUID_DEVCLASS_UNKNOWN;
-    }
-
-    cr = CM_Get_Device_ID(dnDevInst,
-                          DevName,
-                          MAX_DEV_LEN,
-                          0);
-    if (cr != CR_SUCCESS)
-        return NULL;
-
-    ulLength = MAX_DEV_LEN * sizeof(TCHAR);
-    cr = CM_Get_DevNode_Registry_Property(dnDevInst,
-                                          CM_DRP_FRIENDLYNAME,
-                                          NULL,
-                                          FriendlyName,
-                                          &ulLength,
-                                          0);
-    if (cr != CR_SUCCESS)
-    {
-        ulLength = MAX_DEV_LEN * sizeof(TCHAR);
-        cr = CM_Get_DevNode_Registry_Property(dnDevInst,
-                                              CM_DRP_DEVICEDESC,
-                                              NULL,
-                                              FriendlyName,
-                                              &ulLength,
-                                              0);
-        if (cr != CR_SUCCESS)
-            return NULL;
-    }
-
-    if (!SetupDiGetClassImageIndex(&ImageListData,
-                                   &ClassGuid,
-                                   &ClassImage))
-    {
-        /* FIXME: can we do this?
-         * Set the blank icon: IDI_SETUPAPI_BLANK = 41
-         * it'll be image 24 in the imagelist */
-        ClassImage = 24;
-    }
-
-    if (DevName != NULL)
-    {
-        DeviceID = HeapAlloc(GetProcessHeap(),
-                             0,
-                             (lstrlen(DevName) + 1) * sizeof(TCHAR));
-        if (DeviceID == NULL)
-        {
-            return NULL;
-        }
-
-        lstrcpy(DeviceID, DevName);
-    }
-
-    return InsertIntoTreeView(hTreeView,
-                              hRoot,
-                              FriendlyName,
-                              DeviceID,
-                              ClassImage,
-                              0);
-}
-
-
-static VOID
-EnumChildDevices(HWND hTreeView,
-                 HTREEITEM hRoot,
-                 DEVINST dnParentDevInst,
-                 BOOL bShowHidden)
-{
-    HTREEITEM hDevItem;
-    DEVINST dnDevInst;
-    CONFIGRET cr;
-
-    cr = CM_Get_Child(&dnDevInst,
-                      dnParentDevInst,
-                      0);
-    if (cr != CR_SUCCESS)
-        return;
-
-    hDevItem = AddDeviceToTree(hTreeView,
-                               hRoot,
-                               dnDevInst,
-                               bShowHidden);
-    if (hDevItem != NULL)
-    {
-        EnumChildDevices(hTreeView,
-                         hDevItem,
-                         dnDevInst,
-                         bShowHidden);
-    }
-
-    while (cr == CR_SUCCESS)
-    {
-        cr = CM_Get_Sibling(&dnDevInst,
-                            dnDevInst,
-                            0);
-        if (cr != CR_SUCCESS)
-            break;
-
-        hDevItem = AddDeviceToTree(hTreeView,
-                                   hRoot,
-                                   dnDevInst,
-                                   bShowHidden);
-        if (hDevItem != NULL)
-        {
-            EnumChildDevices(hTreeView,
-                             hDevItem,
-                             dnDevInst,
-                             bShowHidden);
-        }
-    }
-
-    (void)TreeView_SortChildren(hTreeView,
-                                hRoot,
-                                0);
-}
-
-
-VOID
-ListDevicesByConnection(HWND hTreeView,
-                        HTREEITEM hRoot,
-                        BOOL bShowHidden)
-{
-    DEVINST devInst;
-    CONFIGRET cr;
-
-    cr = CM_Locate_DevNode(&devInst,
-                           NULL,
-                           CM_LOCATE_DEVNODE_NORMAL);
-    if (cr == CR_SUCCESS)
-        EnumChildDevices(hTreeView,
-                         hRoot,
-                         devInst,
-                         bShowHidden);
-
-    (void)TreeView_Expand(hTreeView,
-                          hRoot,
-                          TVE_EXPAND);
-
-    (void)TreeView_SelectItem(hTreeView,
-                              hRoot);
-}
-
-
-HTREEITEM
-InitTreeView(HWND hTreeView)
-{
-    HTREEITEM hRoot;
-    TCHAR ComputerName[MAX_PATH];
-    DWORD dwSize = MAX_PATH;
-    INT RootImage;
-
-    (void)TreeView_DeleteAllItems(hTreeView);
-
-    /* Get the device image list */
-    ImageListData.cbSize = sizeof(ImageListData);
-    SetupDiGetClassImageList(&ImageListData);
-
-    (void)TreeView_SetImageList(hTreeView,
-                                ImageListData.ImageList,
-                                TVSIL_NORMAL);
-
-    if (!GetComputerName(ComputerName,
-                         &dwSize))
-    {
-        ComputerName[0] = _T('\0');
-    }
-
-    /* Get the image index of the computer class */
-    SetupDiGetClassImageIndex(&ImageListData,
-                              &GUID_DEVCLASS_COMPUTER,
-                              &RootImage);
-
-    /* Insert the root item into the tree */
-    hRoot = InsertIntoTreeView(hTreeView,
-                               NULL,
-                               ComputerName,
-                               NULL,
-                               RootImage,
-                               0);
-
-    return hRoot;
-}
diff --git a/base/applications/mscutils/devmgmt/lang/bg-BG.rc b/base/applications/mscutils/devmgmt/lang/bg-BG.rc
deleted file mode 100644 (file)
index b858552..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Файл"
-    BEGIN
-        MENUITEM "Из&ход", IDC_EXIT
-    END
-    POPUP "Действие"
-    BEGIN
-        MENUITEM "Отпечатване", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Свойства", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Помощ", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Изглед"
-    BEGIN
-        MENUITEM "Устройствата според вид", IDC_DEVBYTYPE
-        MENUITEM "Устройствата според свързването", IDC_DEVBYCONN
-        MENUITEM "Средствата според вида", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Средствата според свързването", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Show hidden devices", IDC_SHOWHIDDEN
-    END
-    POPUP "Помощ"
-    BEGIN
-        MENUITEM "Помощ", IDC_PROGHELP
-        MENUITEM "За", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Свойства", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Помощ", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "За управителя на устройствата"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Device Manager v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "Close", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Свойства"
-    IDS_TOOLTIP_REFRESH "Опресняване"
-    IDS_TOOLTIP_HELP "Помощ"
-    IDS_TOOLTIP_EXIT "Изход"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "Управител на устройствата на РеактОС"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Излиза от приложението."
-    IDS_HINT_REFRESH " Опреснява списъка на услугите."
-    IDS_HINT_PROP " Отваря лист за свойства за текущия избор."
-    IDS_HINT_HELP " Показва помощен прозорец."
-    IDS_HINT_ABOUT " За управителя на устрйствата на РеактОС."
-    IDS_HINT_SYS_RESTORE " Възстановява прозореца до обичайния му рамер."
-    IDS_HINT_SYS_MOVE " Премества прозореца."
-    IDS_HINT_SYS_SIZE " Преоразмерява прозореца."
-    IDS_HINT_SYS_MINIMIZE " Свива прозореца в значка."
-    IDS_HINT_SYS_MAXIMIZE " Разгръща прозореца, докато запълни целия екран."
-    IDS_HINT_SYS_CLOSE " Затваря прозореца."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/cs-CZ.rc b/base/applications/mscutils/devmgmt/lang/cs-CZ.rc
deleted file mode 100644 (file)
index f56d941..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-LANGUAGE LANG_CZECH, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Soubor"
-    BEGIN
-        MENUITEM "&Konec", IDC_EXIT
-    END
-    POPUP "&Akce"
-    BEGIN
-        MENUITEM "Tisk", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Vlastnosti", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Nápověda", IDC_PROGHELP, GRAYED
-    END
-    POPUP "&Zobrazení"
-    BEGIN
-        MENUITEM "Zařízení podle typu", IDC_DEVBYTYPE
-        MENUITEM "Zařízení podle připojení", IDC_DEVBYCONN
-        MENUITEM "Prostředky podle typu", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Prostředky podle připojení", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Zobrazit skrytá zařízení", IDC_SHOWHIDDEN
-    END
-    POPUP "Nápověda"
-    BEGIN
-        MENUITEM "Nápověda", IDC_PROGHELP
-        MENUITEM "O programu", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Vlastnosti", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Nápověda", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "O Správci zařízení"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Správce zařízení v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "Zavřít", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Vlastnosti"
-    IDS_TOOLTIP_REFRESH "Obnovit"
-    IDS_TOOLTIP_HELP "Nápověda"
-    IDS_TOOLTIP_EXIT "Konec"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "ReactOS Správce zařízení"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Ukončit pogram."
-    IDS_HINT_REFRESH " Obnovit seznam zařízení."
-    IDS_HINT_PROP " Zobrazit kartu vlastností pro vybranou položku."
-    IDS_HINT_HELP " Zobrazit nápovědu."
-    IDS_HINT_ABOUT " O ReactOS Správci zařízení."
-    IDS_HINT_SYS_RESTORE " Obnoví normální velikost okna."
-    IDS_HINT_SYS_MOVE " Přesune okno."
-    IDS_HINT_SYS_SIZE " Změní velikost okna."
-    IDS_HINT_SYS_MINIMIZE " Minimalizuje okno."
-    IDS_HINT_SYS_MAXIMIZE " Maximalizuje okno."
-    IDS_HINT_SYS_CLOSE " Zavře toto okno."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/de-DE.rc b/base/applications/mscutils/devmgmt/lang/de-DE.rc
deleted file mode 100644 (file)
index 9bca584..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Datei"
-    BEGIN
-        MENUITEM "&Beenden", IDC_EXIT
-    END
-    POPUP "Aktion"
-    BEGIN
-        MENUITEM "Drucken", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Eigenschaften", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Hilfe", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Ansicht"
-    BEGIN
-        MENUITEM "Geräte nach Typ", IDC_DEVBYTYPE
-        MENUITEM "Geräte nach Verbindung", IDC_DEVBYCONN
-        MENUITEM "Resourcen nach Typ", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Resourcen nach Verbindung", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Ausgeblendete Geräte anzeigen", IDC_SHOWHIDDEN
-    END
-    POPUP "&?"
-    BEGIN
-        MENUITEM "Hilfe", IDC_PROGHELP
-        MENUITEM "Info", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Eigenschaften", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Hilfe", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "Über Geräte-Manager"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Geräte-Manager v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 26
-    PUSHBUTTON "Schließen", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "Dieses Programm ist Freie Software: Sie können es unter den Bedingungen der GNU General Public License, wie von der Free Software Foundation, Version 2.1 der Lizenz oder (nach Ihrer Wahl) jeder neueren veröffentlichten Version, weiterverbreiten und/oder modifizieren.\r\n\r\nDieses Programm wird in der Hoffnung, dass es nützlich sein wird, aber OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.\r\n\r\nSie sollten eine Kopie der GNU General Public License zusammen mit diesem Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Eigenschaften"
-    IDS_TOOLTIP_REFRESH "Aktualisieren"
-    IDS_TOOLTIP_HELP "Hilfe"
-    IDS_TOOLTIP_EXIT "Beenden"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "ReactOS Geräte-Manager"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Das Programm beenden."
-    IDS_HINT_REFRESH " Die Service-Liste aktualisieren."
-    IDS_HINT_PROP " Eigenschaften für die aktuelle Auswahl anzeigen."
-    IDS_HINT_HELP " Hilfe-Fenster anzeigen."
-    IDS_HINT_ABOUT " Über ReactOS Geräte-Manager."
-    IDS_HINT_SYS_RESTORE " Dieses Fenster auf normale Größe wiederherstellen."
-    IDS_HINT_SYS_MOVE " Dieses Fenster verschieben."
-    IDS_HINT_SYS_SIZE " Größe dieses Fensters ändern."
-    IDS_HINT_SYS_MINIMIZE " Dieses Fenster zu einem Symbol verkleinern."
-    IDS_HINT_SYS_MAXIMIZE " Dieses Fenster auf Bildschirmgröße vergrößern."
-    IDS_HINT_SYS_CLOSE " Dieses Fenster schließen."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/el-GR.rc b/base/applications/mscutils/devmgmt/lang/el-GR.rc
deleted file mode 100644 (file)
index a4d7f39..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-LANGUAGE LANG_GREEK, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Αρχείο"
-    BEGIN
-        MENUITEM "Έ&ξοδος", IDC_EXIT
-    END
-    POPUP "Ενέργεια"
-    BEGIN
-        MENUITEM "Εκτύπωση", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Ιδιότητες", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Βοήθεια", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Εμφάνιση"
-    BEGIN
-        MENUITEM "Συσκευές ανά τύπο", IDC_DEVBYTYPE
-        MENUITEM "Συσκευές ανά σύνδεση", IDC_DEVBYCONN
-        MENUITEM "Πηγές ανά τύπο", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Πηγές ανά σύνδεση", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Show hidden devices", IDC_SHOWHIDDEN
-    END
-    POPUP "Βοήθεια"
-    BEGIN
-        MENUITEM "Βοήθεια", IDC_PROGHELP
-        MENUITEM "Σχετικά...", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Ιδιότητες", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Βοήθεια", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "Σχετικά με η διαχείριση συσκεών"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Device Manager v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 26
-    PUSHBUTTON "Close", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Ιδιότητες"
-    IDS_TOOLTIP_REFRESH "Ανανέωση"
-    IDS_TOOLTIP_HELP "Βοήθεια"
-    IDS_TOOLTIP_EXIT "Έξοδος"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "Διαχείριση Συσκευών του ReactOS"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Τερματίζει το πρόγραμμα."
-    IDS_HINT_REFRESH " Ανανέωση της λίστας διεργασιών."
-    IDS_HINT_PROP " Άνοιγμα παραθύρου ιδιοτήτων για τη συγκεκριμένη επιλογή."
-    IDS_HINT_HELP " Εμφάνιση παραθύρου βοήθειας."
-    IDS_HINT_ABOUT " Σχετικά με τη Διαχείριση Συσκευών του ReactOS."
-    IDS_HINT_SYS_RESTORE " Επαναφέρει το παράθυρο αυτό στο κανονικο του μέγεθος."
-    IDS_HINT_SYS_MOVE " Μετακινεί αυτό το παράθυρο."
-    IDS_HINT_SYS_SIZE " Αλλάζει το μέγεθος αυτού του παραθύρου."
-    IDS_HINT_SYS_MINIMIZE " Μικραίνει αυτό το παράθυρο σε ένα εικονίδιο."
-    IDS_HINT_SYS_MAXIMIZE " Προσαρμόζει το μέγεθος του παραθύρου αυτού στην οθόνη."
-    IDS_HINT_SYS_CLOSE " Κλείνει αυτό το παράθυρο."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/en-US.rc b/base/applications/mscutils/devmgmt/lang/en-US.rc
deleted file mode 100644 (file)
index 09cfbb0..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&File"
-    BEGIN
-        MENUITEM "E&xit", IDC_EXIT
-    END
-    POPUP "Action"
-    BEGIN
-        MENUITEM "Print", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Properties", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Help", IDC_PROGHELP, GRAYED
-    END
-    POPUP "View"
-    BEGIN
-        MENUITEM "Devices by type", IDC_DEVBYTYPE
-        MENUITEM "Devices by connection", IDC_DEVBYCONN
-        MENUITEM "Resources by type", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Resources by connection", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Show hidden devices", IDC_SHOWHIDDEN
-    END
-    POPUP "Help"
-    BEGIN
-        MENUITEM "Help", IDC_PROGHELP
-        MENUITEM "About", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Properties", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Help", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "About Device Manager"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Device Manager v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "Close", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Properties"
-    IDS_TOOLTIP_REFRESH "Refresh"
-    IDS_TOOLTIP_HELP "Help"
-    IDS_TOOLTIP_EXIT "Exit"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "ReactOS Device Manager"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Exits the program."
-    IDS_HINT_REFRESH " Refresh the service list."
-    IDS_HINT_PROP " Open property sheet for the current selection."
-    IDS_HINT_HELP " Display help window."
-    IDS_HINT_ABOUT " About ReactOS Device Manager."
-    IDS_HINT_SYS_RESTORE " Restores this window to normal size."
-    IDS_HINT_SYS_MOVE " Moves this window."
-    IDS_HINT_SYS_SIZE " Resizes this window."
-    IDS_HINT_SYS_MINIMIZE " Collapses this window to an icon."
-    IDS_HINT_SYS_MAXIMIZE " Expands this window to fill this screen."
-    IDS_HINT_SYS_CLOSE " Closes this window."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/es-ES.rc b/base/applications/mscutils/devmgmt/lang/es-ES.rc
deleted file mode 100644 (file)
index 9c69a10..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Spanish Language resource file
- * Traducido por: Javier Remacha 2007-12-21
- * Corregido por: Ismael Ferrera Morezuelas 2014-12-31
- */
-
-LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Archivo"
-    BEGIN
-        MENUITEM "&Salir", IDC_EXIT
-    END
-    POPUP "Acción"
-    BEGIN
-        MENUITEM "Imprimir", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Propiedades", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Ayuda", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Ver"
-    BEGIN
-        MENUITEM "Dispositivos por tipo", IDC_DEVBYTYPE
-        MENUITEM "Dispositivos por conexión", IDC_DEVBYCONN
-        MENUITEM "Recursos por tipo", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Recursos por conexión", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Mostrar dispositivos ocultos", IDC_SHOWHIDDEN
-    END
-    POPUP "Ayuda"
-    BEGIN
-        MENUITEM "Ayuda", IDC_PROGHELP
-        MENUITEM "Acerca de", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Propiedades", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Ayuda", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "Acerca del Administrador de dispositivos"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Administrador de dispositivos v0.1\nCopyright (C) 2006\nCreado por Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 26
-    PUSHBUTTON "Cerrar", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "Este programa es software libre; puedes redistribuirlo y/o modificarlo bajo los términos de la GNU General Public License tal y como fueron publicados por la Free Software Foundation; ya sea la versión 2 de la Licencia, o (bajo tu discreción) cualquier versión posterior.\r\n\r\nEste programa se distribuye con el fin de ser útil, pero viene SIN NINGUNA GARANTÍA; sin tan siquiera la garantía implícita de COMERCIALIZACIÓN o la de IDONEIDAD PARA UN PROPÓSITO CONCRETO. Para más información lee la GNU General Public License.\r\n\r\nDeberías de haber recibido una copia de la GNU General Public License con el programa; si no, puedes escribir a la Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 EE.UU."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Propiedades"
-    IDS_TOOLTIP_REFRESH "Actualizar"
-    IDS_TOOLTIP_HELP "Ayuda"
-    IDS_TOOLTIP_EXIT "Salir"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "Administrador de dispositivos de ReactOS"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Cierra el programa."
-    IDS_HINT_REFRESH " Actualizar la lista de servicios."
-    IDS_HINT_PROP " Abre la pestaña de propiedades de la selección actual."
-    IDS_HINT_HELP " Mostrar la ventana de ayuda."
-    IDS_HINT_ABOUT " Acerca del Administrador de dispositivos de ReactOS."
-    IDS_HINT_SYS_RESTORE " Devuelve esta ventana al tamaño normal."
-    IDS_HINT_SYS_MOVE " Mueve esta ventana."
-    IDS_HINT_SYS_SIZE " Redimensiona esta ventana."
-    IDS_HINT_SYS_MINIMIZE " Contrae esta ventana en un icono."
-    IDS_HINT_SYS_MAXIMIZE " Expande esta ventana hasta ocupar la pantalla."
-    IDS_HINT_SYS_CLOSE " Cierra esta ventana."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/fr-FR.rc b/base/applications/mscutils/devmgmt/lang/fr-FR.rc
deleted file mode 100644 (file)
index 39accf0..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Fichier"
-    BEGIN
-        MENUITEM "&Quitter", IDC_EXIT
-    END
-    POPUP "Action"
-    BEGIN
-        MENUITEM "Imprimer", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Propriétés", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Aide", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Affichage"
-    BEGIN
-        MENUITEM "Périphériques par type", IDC_DEVBYTYPE
-        MENUITEM "Périphériques par connexion", IDC_DEVBYCONN
-        MENUITEM "Ressources par type", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Ressources par connexion", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Afficher les périphériques cachés", IDC_SHOWHIDDEN
-    END
-    POPUP "Aide"
-    BEGIN
-        MENUITEM "Aide", IDC_PROGHELP
-        MENUITEM "À propos", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Propriétés", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Aide", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "À propos du Gestionnaire de Périphériques"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Gestionnaire de Périphériques v0.1\nCopyright (C) 2006\npar Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 26
-    PUSHBUTTON "Fermer", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "Ce programme est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier tout en respectant les termes de la ""GNU General Public License"" publiée par la Free Software Foundation; dans sa version 2  (ou selon votre préférence) toute version ultérieure.\r\n\r\nCe programme est distribué dans l'espoir qu'il sera utile, cependant SANS GARANTIE D'AUCUNE SORTE ; sans même une garantie implicite de COMMERCIABILITÉ ou DE CONFORMITÉ À UNE UTILISATION PARTICULIÈRE. \r\n\r\nVoir la Licence Publique Générale GNU pour plus de détails. Vous devriez avoir reçu un exemplaire de la Licence Publique Générale GNU avec ce programme ; si ce n'est pas le cas, écrivez à la Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Propriétés"
-    IDS_TOOLTIP_REFRESH "Actualiser"
-    IDS_TOOLTIP_HELP "Aide"
-    IDS_TOOLTIP_EXIT "Quitter"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "Gestionnaire de périphériques ReactOS"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Quitte le programme."
-    IDS_HINT_REFRESH " Actualise la liste des périphériques."
-    IDS_HINT_PROP " Ouvre la feuille de propriétés pour la sélection actuelle."
-    IDS_HINT_HELP " Affiche la fenêtre d'aide."
-    IDS_HINT_ABOUT " À propos du Gestionnaire de Périphériques de ReactOS."
-    IDS_HINT_SYS_RESTORE " Restaure cette fenêtre à sa taille normale."
-    IDS_HINT_SYS_MOVE " Déplace cette fenêtre."
-    IDS_HINT_SYS_SIZE " Redimensionne cette fenêtre."
-    IDS_HINT_SYS_MINIMIZE " Réduit cette fenêtre à une icône."
-    IDS_HINT_SYS_MAXIMIZE " Étend cette fenêtre à l'écran."
-    IDS_HINT_SYS_CLOSE " Ferme cette fenêtre."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/he-IL.rc b/base/applications/mscutils/devmgmt/lang/he-IL.rc
deleted file mode 100644 (file)
index c248427..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&קובץ"
-    BEGIN
-        MENUITEM "&יציאה", IDC_EXIT
-    END
-    POPUP "פעולה"
-    BEGIN
-        MENUITEM "הדפס", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "מאפיינים", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "עזרה", IDC_PROGHELP, GRAYED
-    END
-    POPUP "תצוגה"
-    BEGIN
-        MENUITEM "התקנים לפי סוג", IDC_DEVBYTYPE
-        MENUITEM "התקנים לפי חיבור", IDC_DEVBYCONN
-        MENUITEM "משאבים לפי סוג", IDC_RESBYTYPE, GRAYED
-        MENUITEM "משאבים לפי חיבור", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "הראה התקנים מוסתרים", IDC_SHOWHIDDEN
-    END
-    POPUP "עזרה"
-    BEGIN
-        MENUITEM "עזרה", IDC_PROGHELP
-        MENUITEM "אודות", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "מאפיינים", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "עזרה", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "אודות מנהל ההתקנים"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Device Manager v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "סגור", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "מאפיינים"
-    IDS_TOOLTIP_REFRESH "רענן"
-    IDS_TOOLTIP_HELP "עזרה"
-    IDS_TOOLTIP_EXIT "יציאה"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "מנהל ההתקנים של ReactOS"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " סוגר את התכנית."
-    IDS_HINT_REFRESH " מרענן את רשימת השירותים."
-    IDS_HINT_PROP " Open property sheet for the current selection."
-    IDS_HINT_HELP " מראה חלון עזרה."
-    IDS_HINT_ABOUT " אודות מנהל ההתקנים של ReactOS"
-    IDS_HINT_SYS_RESTORE " מחזיר את החלון לגודלו הרגיל"
-    IDS_HINT_SYS_MOVE " מזיז חלון זה"
-    IDS_HINT_SYS_SIZE " משנה גודל חלון זה"
-    IDS_HINT_SYS_MINIMIZE " מוריד חלון זה לסמל"
-    IDS_HINT_SYS_MAXIMIZE " מרחיב את החלון לכל המסך."
-    IDS_HINT_SYS_CLOSE " סוגר חלון זה."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/id-ID.rc b/base/applications/mscutils/devmgmt/lang/id-ID.rc
deleted file mode 100644 (file)
index cb8b77c..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-LANGUAGE LANG_INDONESIAN, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&File"
-    BEGIN
-        MENUITEM "E&xit", IDC_EXIT
-    END
-    POPUP "Aksi"
-    BEGIN
-        MENUITEM "Cetak", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Properti", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Bantuan", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Lihat"
-    BEGIN
-        MENUITEM "Device dengan tipe", IDC_DEVBYTYPE
-        MENUITEM "Device dengan koneksi", IDC_DEVBYCONN
-        MENUITEM "Resource dengan tipe", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Resource dengan koneksi", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Show hidden devices", IDC_SHOWHIDDEN
-    END
-    POPUP "Bantuan"
-    BEGIN
-        MENUITEM "Bantuan", IDC_PROGHELP
-        MENUITEM "Tentang", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Properti", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Bantuan", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "Tentang Manajer Device"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Manajer Device v0.1\nHak Cipta (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 26
-    PUSHBUTTON "Tutup", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "Program ini adalah software bebas; anda dapat mendistribusikan dan/atau mengubahnya di bawah term GNU General Public License seperti dipublikasikan oleh Free Software Foundation; baik Lisensi versi 2, atau (menurut opini anda) setiap versi berikutnya.\r\n\r\nProgram ini didistribusikan dengan harapan ia akan berguna, tetapi TANPA JAMINAN APAPUN; bahkan tanpa jaminan berarti dari MERCANTABILITAS atau KECUKUPAN UNTUK KEPERLUAN TERTENTU.  Lihat GNU General Public License untuk lebih jelasnya.\r\n\r\nAnda seharusnya menerima duplikat GNU General Public License bersamaan dengan program ini; jika tidak, tulis ke Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Properti"
-    IDS_TOOLTIP_REFRESH "Segarkan"
-    IDS_TOOLTIP_HELP "Bantuan"
-    IDS_TOOLTIP_EXIT "Keluar"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "Manajer Device ReactOS"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Keluar dari program."
-    IDS_HINT_REFRESH " Segarkan daftar layanan."
-    IDS_HINT_PROP " VBuka lembar properti untuk pilihan saat ini."
-    IDS_HINT_HELP " Menampilkan jendela bantuan."
-    IDS_HINT_ABOUT " Tentang Manajer Device ReactOS."
-    IDS_HINT_SYS_RESTORE " Menyimpan kembali jendela ini ke ukuran normal."
-    IDS_HINT_SYS_MOVE " Memindahkan jendela ini."
-    IDS_HINT_SYS_SIZE " Mengukur ulang jendela ini."
-    IDS_HINT_SYS_MINIMIZE " Menyempitkan jendela ini menjadi ikon."
-    IDS_HINT_SYS_MAXIMIZE " Melebarkan jendela ini untuk memenuhi layar ini."
-    IDS_HINT_SYS_CLOSE " Menutup jendela ini."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/it-IT.rc b/base/applications/mscutils/devmgmt/lang/it-IT.rc
deleted file mode 100644 (file)
index 995dc50..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&File"
-    BEGIN
-        MENUITEM "E&sci", IDC_EXIT
-    END
-    POPUP "Azioni"
-    BEGIN
-        MENUITEM "Stampa", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Proprietà", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Aiuto", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Visualizza"
-    BEGIN
-        MENUITEM "Dispositivi per tipo", IDC_DEVBYTYPE
-        MENUITEM "Dispositivi per connessione", IDC_DEVBYCONN
-        MENUITEM "Risorse per tipo", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Risorse per connessione", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Mostra periferiche nascoste", IDC_SHOWHIDDEN
-    END
-    POPUP "Aiuto"
-    BEGIN
-        MENUITEM "Aiuto", IDC_PROGHELP
-        MENUITEM "Informazioni su", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Proprietà", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Aiuto", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "Informazioni su Gestione Dispositivi"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Gestione dispositivi v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 26
-    PUSHBUTTON "Chiudi", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "Questo programma è software libero; puoi distribuirlo e/o modificarlo nei termini di licenza di 'GNU General Public License' come pubblicata dalla 'Free Software Foundation'; entrambe le versioni 2 della Licenza, o (a vostra scelta) qualunque versione successiva.\r\n\r\nQuesto programma è distribuito con l'augurio che sia utile, ma PRIVO DI OGNI GARANZIA; privo anche della garanzia implicita di COMMERCIABILITÀ o UTILIZZABILITÀ PER UNO SPECIFICO USO. Vedi la 'GNU General Public License' per ulteriori dettagli.\r\n\r\nVoi dovreste aver ricevuto una copia della 'GNU General Public License' assieme a questo programma; se non è cosi' scrivete a 'Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Proprietà"
-    IDS_TOOLTIP_REFRESH "Aggiorna"
-    IDS_TOOLTIP_HELP "Aiuto"
-    IDS_TOOLTIP_EXIT "Esci"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "ReactOS: Gestione Dispositivi"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Esci dal programma."
-    IDS_HINT_REFRESH " Aggiorna la lista dei servizi."
-    IDS_HINT_PROP " Apri le proprietà per la selezione attuale."
-    IDS_HINT_HELP " Visualizza la finestra di aiuto."
-    IDS_HINT_ABOUT " Informazioni su Gestione dispositivi di ReactOS."
-    IDS_HINT_SYS_RESTORE " Ripristina la dimensione normale di questa finestra."
-    IDS_HINT_SYS_MOVE " Muove questa finestra."
-    IDS_HINT_SYS_SIZE " Cambia la dimensione di questa finestra."
-    IDS_HINT_SYS_MINIMIZE " Riduce a icona questa finestra."
-    IDS_HINT_SYS_MAXIMIZE " Espande questa finestra fino a riempire lo schermo."
-    IDS_HINT_SYS_CLOSE " Chiude questa finestra."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/ja-JP.rc b/base/applications/mscutils/devmgmt/lang/ja-JP.rc
deleted file mode 100644 (file)
index 0aba75b..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "ファイル(&F)"
-    BEGIN
-        MENUITEM "終了(&X)", IDC_EXIT
-    END
-    POPUP "操作"
-    BEGIN
-        MENUITEM "印刷", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "プロパティ", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "ヘルプ", IDC_PROGHELP, GRAYED
-    END
-    POPUP "表示"
-    BEGIN
-        MENUITEM "デバイス (種類別)", IDC_DEVBYTYPE
-        MENUITEM "デバイス (接続別)", IDC_DEVBYCONN
-        MENUITEM "リソース (種類別)", IDC_RESBYTYPE, GRAYED
-        MENUITEM "リソース (接続別)", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Show hidden devices", IDC_SHOWHIDDEN
-    END
-    POPUP "ヘルプ"
-    BEGIN
-        MENUITEM "ヘルプ", IDC_PROGHELP
-        MENUITEM "バージョン情報", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "プロパティ", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "ヘルプ", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "デバイス マネージャについて"
-FONT 9, "MS UI Gothic", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "デバイス マネージャ v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "閉じる", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "プロパティ"
-    IDS_TOOLTIP_REFRESH "更新"
-    IDS_TOOLTIP_HELP "ヘルプ"
-    IDS_TOOLTIP_EXIT "終了"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "ReactOS デバイス マネージャ"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " このプログラムを終了します。"
-    IDS_HINT_REFRESH " サービスのリストを更新します。"
-    IDS_HINT_PROP " 現在選択されているシートのプロパティを開きます。"
-    IDS_HINT_HELP " ヘルプ ウィンドウを表示します。"
-    IDS_HINT_ABOUT " ReactOS デバイス マネージャについて表示します。"
-    IDS_HINT_SYS_RESTORE " このウィンドウを通常の大きさに復元します。"
-    IDS_HINT_SYS_MOVE " このウィンドウを移動します。"
-    IDS_HINT_SYS_SIZE " このウィンドウの大きさを変更します。"
-    IDS_HINT_SYS_MINIMIZE " このウィンドウをアイコンに折りたたみます。"
-    IDS_HINT_SYS_MAXIMIZE " このウィンドウを画面いっぱいに開きます。"
-    IDS_HINT_SYS_CLOSE " このウィンドウを閉じます。"
-END
diff --git a/base/applications/mscutils/devmgmt/lang/ko-KR.rc b/base/applications/mscutils/devmgmt/lang/ko-KR.rc
deleted file mode 100644 (file)
index ca32971..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Korean translation by manatails007(www.manatails007.org) */
-
-LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "파일(&F)"
-    BEGIN
-        MENUITEM "종료(&X)", IDC_EXIT
-    END
-    POPUP "액션"
-    BEGIN
-        MENUITEM "프린트", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "속성", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "도움말", IDC_PROGHELP, GRAYED
-    END
-    POPUP "보기"
-    BEGIN
-        MENUITEM "Devices by type", IDC_DEVBYTYPE
-        MENUITEM "Devices by connection", IDC_DEVBYCONN
-        MENUITEM "Resources by type", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Resources by connection", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Show hidden devices", IDC_SHOWHIDDEN
-    END
-    POPUP "도움말"
-    BEGIN
-        MENUITEM "도움말", IDC_PROGHELP
-        MENUITEM "정보", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "팝업"
-    BEGIN
-        MENUITEM "속성", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "도움말", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "장치 관리자에 대하여"
-FONT 9, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Device Manager v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "Close", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "속성"
-    IDS_TOOLTIP_REFRESH "새로 고침"
-    IDS_TOOLTIP_HELP "도움말"
-    IDS_TOOLTIP_EXIT "종료"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "ReactOS 장치 관리자"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " 프로그램을 종료합니다."
-    IDS_HINT_REFRESH " 서비스 리스트를 새로 고칩니다."
-    IDS_HINT_PROP " 선택한 항목의 속성 창을 엽니다."
-    IDS_HINT_HELP " 도움말을 엽니다."
-    IDS_HINT_ABOUT " ReactOS 장치 관리자에 대해."
-    IDS_HINT_SYS_RESTORE " 이 창을 보통 크기로 맟춤니다."
-    IDS_HINT_SYS_MOVE " 창을 움직입니다."
-    IDS_HINT_SYS_SIZE " 창의 크기를 변경합니다."
-    IDS_HINT_SYS_MINIMIZE " 이 창을 아이콘으로 만듭니다."
-    IDS_HINT_SYS_MAXIMIZE " 이 창을 최대 크기로 맟춤니다."
-    IDS_HINT_SYS_CLOSE " 창을 닫습니다."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/no-NO.rc b/base/applications/mscutils/devmgmt/lang/no-NO.rc
deleted file mode 100644 (file)
index b3b8747..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Fil"
-    BEGIN
-        MENUITEM "A&vslutt", IDC_EXIT
-    END
-    POPUP "Handling"
-    BEGIN
-        MENUITEM "Skriv ut", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Egenskaper", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Hjelp", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Vis"
-    BEGIN
-        MENUITEM "Enheter etter type", IDC_DEVBYTYPE
-        MENUITEM "Enheter etter tilkobling", IDC_DEVBYCONN
-        MENUITEM "Ressurser etter type", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Ressurser etter tilkobling", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Show hidden devices", IDC_SHOWHIDDEN
-    END
-    POPUP "Hjelp"
-    BEGIN
-        MENUITEM "Hjelp", IDC_PROGHELP
-        MENUITEM "Om", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Egenskaper", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Hjelp", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "Om Enhetsbehandler"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Enhetsbehandler v0.1\nEnerett (C) 2006\nlaget av Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "Lukk", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "Dette programmet er gratis programvare; du kan distribuere det og/eller endre det under betingelsene av GNU General Public License som er utgitt av Free Software Foundation;  version 2 av lisensen, eller (etter din mening) alle senere versjoner.\r\n\r\nDette programmet er utgitt i håp for at det skal kunne brukes, men DET ER INGEN GARANTIER; uten heller forutsatt garantier av SALGBARHET eller SIKKETHET FOR EN ENKELTHET FORMÅL.  Se på GNU General Public Lisensen for mere detaljer.\r\n\r\nDu skal ha motatt en kopi av GNU General Public Lisensen sammen med denne programmet; hvis du ikke har motatt det, skriv til Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Egenskaper"
-    IDS_TOOLTIP_REFRESH "Oppdater"
-    IDS_TOOLTIP_HELP "Hjelp"
-    IDS_TOOLTIP_EXIT "Avslutt"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "ReactOS Enhetsbehandler"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Avslutt programmet."
-    IDS_HINT_REFRESH " Oppdater tjeneste listen."
-    IDS_HINT_PROP " Open property sheet for the current selection."
-    IDS_HINT_HELP " Vis hjelp vinduet."
-    IDS_HINT_ABOUT " Om ReactOS Enhetsbehandler."
-    IDS_HINT_SYS_RESTORE " Gjenopprett dette vinduet til vanlig størrelse."
-    IDS_HINT_SYS_MOVE " Flytt dette vinduet."
-    IDS_HINT_SYS_SIZE " Endre størrelse på dette vinduet."
-    IDS_HINT_SYS_MINIMIZE " Gjør om dette vinduet til en ikon."
-    IDS_HINT_SYS_MAXIMIZE " Gjør om dette vinduet til å fylle hele skjermen."
-    IDS_HINT_SYS_CLOSE " Lukk dette vinduet."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/pl-PL.rc b/base/applications/mscutils/devmgmt/lang/pl-PL.rc
deleted file mode 100644 (file)
index 5d762a5..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *    Translated by xrogers
- *    xxrogers@users.sourceforge.net
- *    https://sourceforge.net/projects/reactospl
- *    UTF-8 conversion by Caemyr (May, 2011)
- */
-
-LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Plik"
-    BEGIN
-        MENUITEM "Za&kończ", IDC_EXIT
-    END
-    POPUP "&Akcja"
-    BEGIN
-        MENUITEM "&Drukuj", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "&Właściwości", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Pomo&c", IDC_PROGHELP, GRAYED
-    END
-    POPUP "&Widok"
-    BEGIN
-        MENUITEM "Urządzenia w&edług typu", IDC_DEVBYTYPE
-        MENUITEM "Ur&ządzenia według połączenia", IDC_DEVBYCONN
-        MENUITEM "Zaso&by według typu", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Za&soby według połączenia", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Pokaż ukryte urządzenia", IDC_SHOWHIDDEN
-    END
-    POPUP "Pomo&c"
-    BEGIN
-        MENUITEM "&Tematy pomocy", IDC_PROGHELP
-        MENUITEM "Menedżer urządzeń - i&nformacje", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Właściwości", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Pomoc", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "Menedżer urządzeń - informacje"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Menedżer urządzeń v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 26
-    PUSHBUTTON "Zamknij", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "Niniejszy program jest wolnym oprogramowaniem; możesz go rozprowadzać dalej i/lub modyfikować na warunkach Powszechnej Licencji Publicznej GNU, wydanej przez Fundację Wolnego Oprogramowania - według wersji 2 tej Licencji lub (według twojego wyboru) którejś z późniejszych wersji.\r\n\r\nNiniejszy program rozpowszechniany jest z nadzieją, iż będzie on użyteczny - jednak BEZ JAKIEJKOLWIEK GWARANCJI, nawet domyślnej gwarancji PRZYDATNOŚCI HANDLOWEJ albo PRZYDATNOŚCI DO OKREŚLONYCH ZASTOSOWAŃ. W celu uzyskania bliższych informacji sięgnij do Powszechnej Licencji Publicznej GNU.\r\n\r\nZ pewnością wraz z niniejszym programem otrzymałeś też egzemplarz Powszechnej Licencji Publicznej GNU (GNU General Public License); jeśli nie - napisz do Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Właściwości"
-    IDS_TOOLTIP_REFRESH "Odśwież"
-    IDS_TOOLTIP_HELP "Pomoc"
-    IDS_TOOLTIP_EXIT "Wyjście"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "Menedżer urządzeń ReactOS"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Zamyka program."
-    IDS_HINT_REFRESH " Odśwież listę serwisów."
-    IDS_HINT_PROP " Otwiera arkusz właściwości dla bieżącego zaznaczenia."
-    IDS_HINT_HELP " Otwiera pomoc."
-    IDS_HINT_ABOUT " Informacje o Menedżerze urządzeń ReactOS."
-    IDS_HINT_SYS_RESTORE " Przywraca okno do normalnych rozmiarów."
-    IDS_HINT_SYS_MOVE " Przesuwa to okno."
-    IDS_HINT_SYS_SIZE " Zmienia rozmiar tego okna."
-    IDS_HINT_SYS_MINIMIZE " Minimalizuje to okno do ikony."
-    IDS_HINT_SYS_MAXIMIZE " Rozszerza to okno do rozmiarów ekranu."
-    IDS_HINT_SYS_CLOSE " Zamyka okno."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/pt-BR.rc b/base/applications/mscutils/devmgmt/lang/pt-BR.rc
deleted file mode 100644 (file)
index 07fef0c..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Translation and UTF-8 Conversion by mkbu95 <mkbu95@gmail.com> (May, 2012) */
-
-LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Arquivo"
-    BEGIN
-        MENUITEM "&Sair", IDC_EXIT
-    END
-    POPUP "Ação"
-    BEGIN
-        MENUITEM "Imprimir", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Propriedades", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Ajuda", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Visualizar"
-    BEGIN
-        MENUITEM "Dispositivos por tipo", IDC_DEVBYTYPE
-        MENUITEM "Dispositivos por conexão", IDC_DEVBYCONN
-        MENUITEM "Recursos por tipo", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Recursos por conexão", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Exibir dispositivos ocultos", IDC_SHOWHIDDEN
-    END
-    POPUP "Ajuda"
-    BEGIN
-        MENUITEM "Ajuda", IDC_PROGHELP
-        MENUITEM "Sobre", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Propriedades", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Ajuda", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "Sobre Gerenciador de Dispositivos"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Gerenciador de Dispositivos v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "Fechar", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Propriedades"
-    IDS_TOOLTIP_REFRESH "Atualizar"
-    IDS_TOOLTIP_HELP "Ajuda"
-    IDS_TOOLTIP_EXIT "Sair"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "Gerenciador de Dispositivos ReactOS"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Fecha o programa."
-    IDS_HINT_REFRESH " Atualiza a lista de serviço."
-    IDS_HINT_PROP " Abre uma folha de propriedades para a seleção atual."
-    IDS_HINT_HELP " Exibe tela de ajuda."
-    IDS_HINT_ABOUT " Sobre Gerenciador de Dispositivos ReactOS."
-    IDS_HINT_SYS_RESTORE " Restaura esta janela ao tamanho normal."
-    IDS_HINT_SYS_MOVE " Move esta janela."
-    IDS_HINT_SYS_SIZE " Redimensiona esta janela."
-    IDS_HINT_SYS_MINIMIZE " Reduz esta janela a um ícone."
-    IDS_HINT_SYS_MAXIMIZE " Expande esta janela ao tamanho da tela."
-    IDS_HINT_SYS_CLOSE " Fecha esta janela."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/ro-RO.rc b/base/applications/mscutils/devmgmt/lang/ro-RO.rc
deleted file mode 100644 (file)
index 897f66b..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Translators: Petru Dimitriu (petrimetri at gmail dot com)
- *              Ștefan Fulea (stefan dot fulea at mail dot md)
- */
-
-LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Fișier"
-    BEGIN
-        MENUITEM "I&eșire", IDC_EXIT
-    END
-    POPUP "A&cțiune"
-    BEGIN
-        MENUITEM "I&mprimare", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "P&roprietăți", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Aj&utor", IDC_PROGHELP, GRAYED
-    END
-    POPUP "&Afișare"
-    BEGIN
-        MENUITEM "Dispozitive după &tip", IDC_DEVBYTYPE
-        MENUITEM "Dispozitive după &conexiune", IDC_DEVBYCONN
-        MENUITEM "Resurse după t&ip", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Resurse după c&onexiune", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Afișea&ză dispozitive ascunse", IDC_SHOWHIDDEN
-    END
-    POPUP "Aj&utor"
-    BEGIN
-        MENUITEM "&Manual…", IDC_PROGHELP
-        MENUITEM "Despre…", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "&Proprietăți", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "&Manual…", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "Despre Gestionarul de dispozitive"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Gestionar de dispozitive v0.1\nDrept de autor (C) 2006\nde Ged Murphy (gedmurphy@gmail.com)\nTraducere de Petru Dimitriu", IDC_STATIC, 48, 7, 130, 35
-    PUSHBUTTON "Î&nchide", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 47, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "Această aplicație este publică; fiind permisă modificarea și/sau (re)distribuția sa în termenii Licenței Publice Generale GNU publicată de Free Software Foundation; sau versiunea 2 a Licenței, sau (la alegere) a oricărei versiuni ulterioare.\r\n\r\nAceastă aplicație este distribuită doar în speranța de a fi utilă, FĂRĂ însă NICI O GARANȚIE; nici măcar cu garanția implicită a VANDABILITĂȚII sau a UTILITĂȚII ÎNTR-UN SCOP ANUME. Pentru mai multe detalii consultați Licența Publică Generală GNU.\r\n\r\nPuteți vedea această licență aici:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nDe asemenea puteți consulta traduceri neoficiale ale acestei licențe aici:\r\nhttp://www.gnu.org/licenses/translations.html"
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Proprietăți"
-    IDS_TOOLTIP_REFRESH "Împrospătare"
-    IDS_TOOLTIP_HELP "Manual de utilizare"
-    IDS_TOOLTIP_EXIT "Ieșire"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "Gestionar de dispozitive ReactOS"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Părăsește programul."
-    IDS_HINT_REFRESH " Împrospătează lista de servicii."
-    IDS_HINT_PROP " Afișează tabel cu proprietăți pentru selecția curentă."
-    IDS_HINT_HELP " Afișează manualul de utilizare."
-    IDS_HINT_ABOUT " Despre Gestionarul de dispozitive."
-    IDS_HINT_SYS_RESTORE " Aduce fereastra la mărime normală."
-    IDS_HINT_SYS_MOVE " Mută fereastra."
-    IDS_HINT_SYS_SIZE " Redimensionează fereastra."
-    IDS_HINT_SYS_MINIMIZE " Reduce fereastra la minim."
-    IDS_HINT_SYS_MAXIMIZE " Mărește fereastra la maxim."
-    IDS_HINT_SYS_CLOSE " Închide fereastra."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/ru-RU.rc b/base/applications/mscutils/devmgmt/lang/ru-RU.rc
deleted file mode 100644 (file)
index 88b01ff..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Russian language resource file (Dmitry Chapyshev, 2007-06-10) */
-
-LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Файл"
-    BEGIN
-        MENUITEM "&Выход", IDC_EXIT
-    END
-    POPUP "Действие"
-    BEGIN
-        MENUITEM "Печать", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Свойства", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Справка", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Вид"
-    BEGIN
-        MENUITEM "Устройства по типу", IDC_DEVBYTYPE
-        MENUITEM "Устройства по подключению", IDC_DEVBYCONN
-        MENUITEM "Ресурсы по типу", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Ресурсы по подключению", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Показать скрытые устройства", IDC_SHOWHIDDEN
-    END
-    POPUP "Справка"
-    BEGIN
-        MENUITEM "Помощь", IDC_PROGHELP
-        MENUITEM "О программе", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Свойства", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Помощь", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "О Диспетчере устройств"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Диспетчер устройств v0.1\nCopyright (C) 2006\nот Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "Закрыть", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "Эта программа является свободно распространяемой; Вы можете распространять ее повторно и (или) изменять, соблюдая условия Открытого лицензионного соглашения GNU, опубликованного Фондом свободно распространяемого программного обеспечения; либо редакции 2 Соглашения, либо (на ваше усмотрение) любой редакции, выпущенной позже.\r\n\r\nЭта программа распространяется в надежде на то, что она окажется полезной, но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, включая подразумеваемую гарантию КАЧЕСТВА либо ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЕННЫХ ЦЕЛЕЙ. Подробности содержатся в Открытом лицензионном соглашении GNU.\r\n\r\nВместе с этой программой должен распространяться экземпляр Открытого лицензионного соглашения GNU, если он отсутствует, сообщите об этом в Фонд свободно распространяемого программного обеспечения (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Свойства"
-    IDS_TOOLTIP_REFRESH "Обновить"
-    IDS_TOOLTIP_HELP "Помощь"
-    IDS_TOOLTIP_EXIT "Выход"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "Диспетчер устройств ReactOS"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Выход из программы."
-    IDS_HINT_REFRESH " Обновить список."
-    IDS_HINT_PROP " Открыть свойства для выбранного элемента."
-    IDS_HINT_HELP " Показать окно справки."
-    IDS_HINT_ABOUT " О Диспетчере устройств ReactOS."
-    IDS_HINT_SYS_RESTORE " Восстановить нормальный размер этого окна."
-    IDS_HINT_SYS_MOVE " Переместить это окно."
-    IDS_HINT_SYS_SIZE " Изменить размер этого окна."
-    IDS_HINT_SYS_MINIMIZE " Свернуть это окно в значок."
-    IDS_HINT_SYS_MAXIMIZE " Развернуть это окно на полный экран."
-    IDS_HINT_SYS_CLOSE " Закрыть это окно."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/sk-SK.rc b/base/applications/mscutils/devmgmt/lang/sk-SK.rc
deleted file mode 100644 (file)
index 8c466f9..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/* TRANSLATOR:  Mário Kačmár /Mario Kacmar/ aka Kario (kario@szm.sk)
- * DATE OF TR.: 14-02-2008
- * LAST CHANGE: 29-08-2008
- */
-
-LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Súbor"
-    BEGIN
-        MENUITEM "&Skončiť", IDC_EXIT
-    END
-    POPUP "Akcia"
-    BEGIN
-        MENUITEM "Tlačiť", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Vlastnosti", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Pomocník", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Zobraziť"
-    BEGIN
-        MENUITEM "Zariadenia podľa typu", IDC_DEVBYTYPE
-        MENUITEM "Zariadenia podľa pripojenia", IDC_DEVBYCONN
-        MENUITEM "Prostriedky podľa typu", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Prostriedky podľa pripojenia", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Show hidden devices", IDC_SHOWHIDDEN
-    END
-    POPUP "Pomocník"
-    BEGIN
-        MENUITEM "Pomocník", IDC_PROGHELP
-        MENUITEM "Čo je ...", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Vlastnosti", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Pomocník", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "Čo je Správca zariadení"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Správca zariadení v0.1\nCopyright (C) 2006\nod Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "Zavrieť", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "Tento program je voľný softvér; môžete ho šíriť a/alebo modifikovať podľa podmienok GNU Všeobecnej verejnej licencie (GNU General Public License) ako bola zverejnená nadáciou Free Software Foundation; buď verzie 2 tejto licencie, alebo (podľa Vášho uváženia) niektorej neskoršej verzie.\r\n\r\nTento program je distribuovaný v nádeji, že bude užitočný, avšak BEZ AKEJKOĽVEK ZÁRUKY; rovnako bez záruky PREDAJNOSTI alebo VHODNOSTI PRE URČITÝ ÚČEL. Pre viac detailov si pozrite GNU Všeobecnú verejnú licenciu (GNU General Public License).\r\n\r\nKópiu Všeobecnej verejnej licencie GNU ste mali dostať spolu s týmto programom; ak nie, napíšte si o ňu na Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Vlastnosti"
-    IDS_TOOLTIP_REFRESH "Obnoviť"
-    IDS_TOOLTIP_HELP "Pomocník"
-    IDS_TOOLTIP_EXIT "Skončiť"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "Správca zariadení systému ReactOS"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Skončí program."
-    IDS_HINT_REFRESH " Obnoví zoznam služieb."
-    IDS_HINT_PROP " Otvorí okno s vlastnosťami pre aktuálny výber."
-    IDS_HINT_HELP " Zobrazí okno pomocníka."
-    IDS_HINT_ABOUT " Čo je Správca zariadení systému ReactOS."
-    IDS_HINT_SYS_RESTORE " Obnoví okno na normálnu veľkosť."
-    IDS_HINT_SYS_MOVE " Premiestni okno."
-    IDS_HINT_SYS_SIZE " Zmení veľkosť okna."
-    IDS_HINT_SYS_MINIMIZE " Zbalí okno na ikonu."
-    IDS_HINT_SYS_MAXIMIZE " Zväčší okno tak, aby zaplnilo celú obrazovku."
-    IDS_HINT_SYS_CLOSE " Zatvorí okno."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/sq-AL.rc b/base/applications/mscutils/devmgmt/lang/sq-AL.rc
deleted file mode 100644 (file)
index 5f73b46..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/* TRANSLATOR : Ardit Dani (Ard1t) (ardit.dani@gmail.com) 
- * DATE OF TR:  29-11-2013
-*/
-
-LANGUAGE LANG_ALBANIAN, SUBLANG_NEUTRAL
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&File"
-    BEGIN
-        MENUITEM "Dil", IDC_EXIT
-    END
-    POPUP "Veprim"
-    BEGIN
-        MENUITEM "Printo", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Tipar", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Ndihmë", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Vëzhgo"
-    BEGIN
-        MENUITEM "Pajisje nga tipi", IDC_DEVBYTYPE
-        MENUITEM "Pajisje nga lidhja", IDC_DEVBYCONN
-        MENUITEM "Burime nga tipi", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Burime nga lidhja", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Shfaq pajisje te fshehura", IDC_SHOWHIDDEN
-    END
-    POPUP "Ndihmë"
-    BEGIN
-        MENUITEM "Ndihmë", IDC_PROGHELP
-        MENUITEM "Rreth", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Tipar", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Ndihmë", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "Rreth Menaxhimit të pajisjeve"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Menaxhues pajisjesh v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "Close", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "Ky program është software falas; ju mund ta shpërndani dhe / ose modifikoni sipas kushteve të GNU General Public License publikuar nga Free Software Foundation; sipas versionit 2 të Liçencës, ose (sipas opinionit tuaj) çdo versioni të mëvonshëm.\r\n\r\nKy program shpërndahet me shpresën që do t'ju jetë i dobishëm, por PA ASNJË GARANCI; madje edhe pa garancinë e shprehur të TREGTUESHMËRISË ose PËRSHTATJES PËR NJË QËLLIM TË CAKTUAR.  Shiko Liçencën Publike të Përgjithshme GNU për më shumë detaje.\r\n\r\nJu duhet të keni marrë një kopje të Liçensës së Përgjithshme Publike GNU së bashku me këtë program, e nëse jo, shkruani në Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Tipar"
-    IDS_TOOLTIP_REFRESH "Rifresko"
-    IDS_TOOLTIP_HELP "Ndihmë"
-    IDS_TOOLTIP_EXIT "Dil"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "Menaxhuesi i pajisjeve ReactOS"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Dil nga programi."
-    IDS_HINT_REFRESH " Rifresko listen e sherbimeve."
-    IDS_HINT_PROP " Hap tiparet e fletes për perzgjedhjen aktuale."
-    IDS_HINT_HELP " Shfaq dritaren e ndihmës."
-    IDS_HINT_ABOUT " Rreth menaxhusit të pajisjeve të ReactOS."
-    IDS_HINT_SYS_RESTORE " Kthe kete dritare ne mase normale."
-    IDS_HINT_SYS_MOVE " Leviz kete dritare."
-    IDS_HINT_SYS_SIZE " Ndryshon permasat e dritares."
-    IDS_HINT_SYS_MINIMIZE " Kthen kete dritare ne ikone."
-    IDS_HINT_SYS_MAXIMIZE " Zmadhon kete dritare ne permasa te ekranit."
-    IDS_HINT_SYS_CLOSE " Mbyll kete dritare."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/sv-SE.rc b/base/applications/mscutils/devmgmt/lang/sv-SE.rc
deleted file mode 100644 (file)
index 71c85c6..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * PROJECT:    ReactOS MSCUTILS
- * FILE:       base/applications/mscutils/devmgmt/lang/sv-SE.rc
- * PURPOSE:    Swedish resource file
- * TRANSLATOR: Jaix Bly
- */
-
-LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Arkiv"
-    BEGIN
-        MENUITEM "A&vsluta", IDC_EXIT
-    END
-    POPUP "Åtgärd"
-    BEGIN
-        MENUITEM "Skriv ut", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Egenskaper", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Hjälp", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Visa"
-    BEGIN
-        MENUITEM "Enheter efter typ", IDC_DEVBYTYPE
-        MENUITEM "Enheter efter koppling", IDC_DEVBYCONN
-        MENUITEM "Resurcer efter typ", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Resurcer efter koppling", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Show hidden devices", IDC_SHOWHIDDEN
-    END
-    POPUP "Hjälp"
-    BEGIN
-        MENUITEM "Hjälp", IDC_PROGHELP
-        MENUITEM "Om", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Egenskaper", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Hjälp", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "Om Enhetshanteraren"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Enhetshanteraren v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "Stäng", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "Detta programmet är fri programvara; du kan distribuera det och/eller ändra det under villkoren enligt GNU General Public License som är utgivet av Free Software Foundation;  version 2, eller (om du så önskar) alla senare versioner.\r\n\r\nDette programmet er utgivet i hopp om att det skall kunne användas, men DET FINNS INGA GARANTIER; även utan underförstådd garanti om SÄLJBARHET eller LÄMPLIGHET FÖR ETT VISST ÄNDAMÅL.  Se på GNU General Public Licensen för mer detaljer.\r\n\r\nDu skall ha motagit en kopia av GNU General Public Licensen tillsammans med detta programmet; om du inte har fått det, skriv til Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Egenskaper"
-    IDS_TOOLTIP_REFRESH "Uppdater"
-    IDS_TOOLTIP_HELP "Hjälp"
-    IDS_TOOLTIP_EXIT "Avsluta"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "ReactOS Enhetshanterare"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Avsluta programmet."
-    IDS_HINT_REFRESH " Uppdatera tjänstelistan."
-    IDS_HINT_PROP " Öppna egenskaper för markerat val."
-    IDS_HINT_HELP " Visa hjälpfönstret."
-    IDS_HINT_ABOUT " Om ReactOS Enhetshanterare."
-    IDS_HINT_SYS_RESTORE " Återställ detta fönstret till normal storlek."
-    IDS_HINT_SYS_MOVE " Flytta detta fönstret."
-    IDS_HINT_SYS_SIZE " Ändra storleken på detta fönstret."
-    IDS_HINT_SYS_MINIMIZE " Minimera detta fönstret till en ikon."
-    IDS_HINT_SYS_MAXIMIZE " Maximera dette fönstret så det fyller hela skärmen."
-    IDS_HINT_SYS_CLOSE " Stäng detta fönstret."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/th-TH.rc b/base/applications/mscutils/devmgmt/lang/th-TH.rc
deleted file mode 100644 (file)
index 9cd5c61..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * PROJECT:   ReactOS Device Management
- * LICENSE:   GPL - See COPYING in the top level directory
- * FILE:      base/applications/mscutils/devmgmt/lang/th-TH.rc
- * PURPOSE:   Thai translation
- * COPYRIGHT: Copyright 2007 Sumath Aowsakulsutthi
- */
-
-LANGUAGE LANG_THAI, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "แ&ฟ้ม"
-    BEGIN
-        MENUITEM "&ออก", IDC_EXIT
-    END
-    POPUP "เริ่มทำ"
-    BEGIN
-        MENUITEM "พิมพ์", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "คุณสมบัติ", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "ช่วยเหลือ", IDC_PROGHELP, GRAYED
-    END
-    POPUP "มุมมอง"
-    BEGIN
-        MENUITEM "อุปกรณ์แบ่งตามประเภท", IDC_DEVBYTYPE
-        MENUITEM "อุปกรณ์แบ่งตามการเชื่อมต่อ", IDC_DEVBYCONN
-        MENUITEM "แหล่งข้อมูลตามประเภท", IDC_RESBYTYPE, GRAYED
-        MENUITEM "แหล่งข้อมูลตามการเชื่อมต่อ", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Show hidden devices", IDC_SHOWHIDDEN
-    END
-    POPUP "ช่วยเหลือ"
-    BEGIN
-        MENUITEM "ช่วยเหลือ", IDC_PROGHELP
-        MENUITEM "เกี่ยวกับ", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "หน้าต่างปัจจุบัน"
-    BEGIN
-        MENUITEM "คุณสมบัติ", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "ช่วยเหลือ", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "เกี่ยวกับการจัดการอุปกรณ์"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Device Manager v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 26
-    PUSHBUTTON "Close", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "คุณสมบัติ"
-    IDS_TOOLTIP_REFRESH "ฟื้นฟู"
-    IDS_TOOLTIP_HELP "ช่วยเหลือ"
-    IDS_TOOLTIP_EXIT "ออกจากโปรแกรม"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "การจัดการอุปกรณ์ของ ReactOS"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " ออกจากโปรแกรม"
-    IDS_HINT_REFRESH " ฟื้นฟูรายการบริการ"
-    IDS_HINT_PROP " เปิดคุณสมบัติของแผ่นงานตามการเลือกในปัจจุบัน"
-    IDS_HINT_HELP " แสดงหน้าต่างช่วยเหลือ"
-    IDS_HINT_ABOUT " เกี่ยวกับการจัดการอุปกรณ์ของ ReactOS"
-    IDS_HINT_SYS_RESTORE " คืนสภาพของหน้าต่างนี้สู่ขนาดปกติ"
-    IDS_HINT_SYS_MOVE " ย้ายหน้าต่างนี้"
-    IDS_HINT_SYS_SIZE " เปลี่ยนขนาดหน้าต่างนี้"
-    IDS_HINT_SYS_MINIMIZE " ย่อหน้าต่างนี้ให้เป็นสัญรูป"
-    IDS_HINT_SYS_MAXIMIZE " ขยายหน้าต่างนี้จนเต็มหน้าจอ"
-    IDS_HINT_SYS_CLOSE " ปิดหน้าต่างนี้"
-END
diff --git a/base/applications/mscutils/devmgmt/lang/tr-TR.rc b/base/applications/mscutils/devmgmt/lang/tr-TR.rc
deleted file mode 100644 (file)
index e0dddb7..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/* TRANSLATOR: 2013, 2014 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
-
-LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Kütük"
-    BEGIN
-        MENUITEM "&Çıkış",                     IDC_EXIT
-    END
-    POPUP "&Eylem"
-    BEGIN
-        MENUITEM "&Yazdır",                    IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "&Husûsiyetler",              IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Y&ardım",                    IDC_PROGHELP, GRAYED
-    END
-    POPUP "&Görünüm"
-    BEGIN
-        MENUITEM "&Türe Göre Aygıtlar",        IDC_DEVBYTYPE
-        MENUITEM "&Bağlantıya Göre Aygıtlar",  IDC_DEVBYCONN
-        MENUITEM "T&üre Göre Kaynaklar",       IDC_RESBYTYPE, GRAYED
-        MENUITEM "B&ağlantıya Göre Kaynaklar", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "&Gizli Aygıtları Göster",    IDC_SHOWHIDDEN
-    END
-    POPUP "&Yardım"
-    BEGIN
-        MENUITEM "&Yardım",                    IDC_PROGHELP
-        MENUITEM "&Üzerine...",                IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "&Husûsiyetler",              IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "&Yardım",                    IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22,16,190,182
-CAPTION "Aygıt Yöneticisi Üzerine"
-FONT 8,"MS Shell Dlg",0,0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Aygıt Yöneticisi - Sürüm: 0.1\nTelif Hakkı: 2006\nGed Murphy (gedmurphy@gmail.com) ile.", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "Tamam", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "ÖNEMLİ: Aşağıdaki metin, özgün metnin resmî olmayan çevirisidir. Çeviri metniyle özgün metin arasında ayrım olabilir. Özgün metin, çeviri metninin altındadır.\r\n\r\n***\r\n\r\nBu izlence özgür yazılımdır; bunu, Özgür Yazılım Vakfı'nın yayımladığı GNU Umûmî Kamu Ruhsatı'nın, 2. sürümünün ya da daha sonraki bir sürümünün (Orası size bağlı.) şartları altında yeniden dağıtabilir veyâ değiştirebilirsiniz.\r\n\r\nBu izlence, kullanışlı olabileceği beklentisiyle dağıtılmıştır ancak bu izlencenin HİÇBİR GÜVENCESİ YOKTUR, SATILABİLİRLİĞİN ve BELİRLİ BİR AMACA UYGUNLUĞUN demek istenilen güvencesi bile. Daha çok bilgi için GNU Umûmî Kamu Ruhsatı'na bakınız.\r\n\r\nBu izlenceyle birlikte GNU Umûmî Kamu Ruhsatı'nın bir kopyasını almış olmalısınız, eğer yoksa Özgür Yazılım Vakfı AŞ'ye (51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ABD) yazınız.\r\n\r\n***\r\n\r\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP      "Husûsiyetler"
-    IDS_TOOLTIP_REFRESH   "Yenile"
-    IDS_TOOLTIP_HELP      "Yardım"
-    IDS_TOOLTIP_EXIT      "Çıkış"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME           "Aygıt Yöneticisi"
-    IDS_HINT_BLANK        " "
-    IDS_HINT_EXIT         " İzlenceden çıkar."
-    IDS_HINT_REFRESH      " Hizmet dizelgesini yeniler."
-    IDS_HINT_PROP         " Şimdiki seçilen için husûsiyet penceresini açar."
-    IDS_HINT_HELP         " Yardım penceresini görüntüler."
-    IDS_HINT_ABOUT        " Aygıt Yöneticisi üzerine."
-    IDS_HINT_SYS_RESTORE  " Bu pencereyi düzgülük boyutlarına döndürür."
-    IDS_HINT_SYS_MOVE     " Bu pencereyi devindirir."
-    IDS_HINT_SYS_SIZE     " Bu pencereyi yeniden boyutlandırır."
-    IDS_HINT_SYS_MINIMIZE " Bu pencereyi bir simgeye küçültür."
-    IDS_HINT_SYS_MAXIMIZE " Bu pencereyi, bu görüntülüğü kaplatana dek genişletir."
-    IDS_HINT_SYS_CLOSE    " Bu pencereyi kapatır."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/uk-UA.rc b/base/applications/mscutils/devmgmt/lang/uk-UA.rc
deleted file mode 100644 (file)
index 6051008..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * PROJECT:    ReactOS Device Management
- * LICENSE:    GPL - See COPYING in the top level directory
- * FILE:       base/applications/mscutils/devmgmt/lang/uk-UA.rc
- * PURPOSE:    Ukraianian Language File for devmgmt
- * TRANSLATOR: Artem Reznikov
- */
-
-LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "&Файл"
-    BEGIN
-        MENUITEM "В&ихід", IDC_EXIT
-    END
-    POPUP "Дія"
-    BEGIN
-        MENUITEM "Друк", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Властивості", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Довідка", IDC_PROGHELP, GRAYED
-    END
-    POPUP "Вигляд"
-    BEGIN
-        MENUITEM "Пристрої за типом", IDC_DEVBYTYPE
-        MENUITEM "Пристрої за підключенням", IDC_DEVBYCONN
-        MENUITEM "Ресурси за типом", IDC_RESBYTYPE, GRAYED
-        MENUITEM "Ресурси за підключенням", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Show hidden devices", IDC_SHOWHIDDEN
-    END
-    POPUP "Довідка"
-    BEGIN
-        MENUITEM "Довідка", IDC_PROGHELP
-        MENUITEM "Про програму", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "Властивості", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "Довідка", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "Про програму Диспетчер пристроїв"
-FONT 8, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "Диспетчер пристроїв v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 26
-    PUSHBUTTON "Закрити", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "Це вільне програмне забезпечення; Ви можете розповсюджувати її та змінювати, дотримуючись умови Відкритої ліцензійної угоди GNU, опублікованої Фондом вільного програмного забезпечення; або редакції 2 Угоди, або будь-якої редакції, випущеної пізніше.\r\n\r\nЦя програма розповсюджується в надії на те, що вона виявиться корисною, але БЕЗ БУДЬ-ЯКИХ ГАРАНТІЙ, включаючи УЯВНОЮ ГАРАНТІЄЮ ЯКОСТІ або ПРИДАТНОСТІ для певних цілей. Подробиці містяться у Відкритій ліцензійній угоді GNU.\r\n\r\nРазом з цією програмою повинен поширюватися примірник Відкритої ліцензійної угоди GNU. Якщо він відсутній, повідомте про це в Фонд вільного програмного забезпечення (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "Властивості"
-    IDS_TOOLTIP_REFRESH "Оновити"
-    IDS_TOOLTIP_HELP "Довідка"
-    IDS_TOOLTIP_EXIT "Вихід"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "Диспетчер пристроїв ReactOS"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " Вийти з програми."
-    IDS_HINT_REFRESH " Оновити список."
-    IDS_HINT_PROP " Відкрити властивості для вибраного елементу."
-    IDS_HINT_HELP " Показати вікно довідки."
-    IDS_HINT_ABOUT " Про Диспетчер пристроїв ReactOS."
-    IDS_HINT_SYS_RESTORE " Відновити вихідний розмір вікна."
-    IDS_HINT_SYS_MOVE " Змінити розташування вікна."
-    IDS_HINT_SYS_SIZE " Змінити розмір вікна."
-    IDS_HINT_SYS_MINIMIZE " Згорнути вікно у значок."
-    IDS_HINT_SYS_MAXIMIZE " Розгорнути вікно на весь екран."
-    IDS_HINT_SYS_CLOSE " Закрити вікно."
-END
diff --git a/base/applications/mscutils/devmgmt/lang/zh-CN.rc b/base/applications/mscutils/devmgmt/lang/zh-CN.rc
deleted file mode 100644 (file)
index a2ce965..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Translated by Song Fuchang (0xfc) <sfc_0@yahoo.com.cn> */
-
-LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
-
-IDR_MAINMENU MENU
-BEGIN
-    POPUP "文件(&F)"
-    BEGIN
-        MENUITEM "退出(&X)", IDC_EXIT
-    END
-    POPUP "动作"
-    BEGIN
-        MENUITEM "打印", IDC_PRINT, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "属性", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "帮助", IDC_PROGHELP, GRAYED
-    END
-    POPUP "查看"
-    BEGIN
-        MENUITEM "设备,按类型", IDC_DEVBYTYPE
-        MENUITEM "设备,按连接", IDC_DEVBYCONN
-        MENUITEM "资源,按类型", IDC_RESBYTYPE, GRAYED
-        MENUITEM "资源,按连接", IDC_RESBYCONN, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "显示隐藏的设备", IDC_SHOWHIDDEN
-    END
-    POPUP "帮助"
-    BEGIN
-        MENUITEM "帮助内容", IDC_PROGHELP
-        MENUITEM "关于", IDC_ABOUT
-    END
-END
-
-IDR_POPUP MENU
-BEGIN
-    POPUP "popup"
-    BEGIN
-        MENUITEM "属性", IDC_PROP, GRAYED
-        MENUITEM SEPARATOR
-        MENUITEM "帮助", IDC_PROGHELP
-    END
-END
-
-IDD_ABOUTBOX DIALOGEX 22, 16, 190, 182
-CAPTION "关于设备管理器"
-FONT 9, "MS Shell Dlg", 0, 0
-STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
-BEGIN
-    LTEXT "设备管理器 v0.1 版权所有 (C) 2006\n作者 Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30
-    PUSHBUTTON "关闭", IDOK, 75, 162, 44, 15
-    ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30
-    EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
-END
-
-STRINGTABLE
-BEGIN
-    IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
-END
-
-STRINGTABLE
-BEGIN
-    IDS_TOOLTIP_PROP "属性"
-    IDS_TOOLTIP_REFRESH "刷新"
-    IDS_TOOLTIP_HELP "帮助"
-    IDS_TOOLTIP_EXIT "退出"
-END
-
-/* Hints */
-STRINGTABLE
-BEGIN
-    IDS_APPNAME "ReactOS 设备管理器"
-    IDS_HINT_BLANK " "
-    IDS_HINT_EXIT " 退出这个程序。"
-    IDS_HINT_REFRESH " 刷新设备列表。"
-    IDS_HINT_PROP " 为当前选择项打开属性页。"
-    IDS_HINT_HELP " 显示帮助窗口。"
-    IDS_HINT_ABOUT " 关于 ReactOS 设备管理器。"
-    IDS_HINT_SYS_RESTORE " 将窗口恢复到默认大小。"
-    IDS_HINT_SYS_MOVE " 移动这个窗口。"
-    IDS_HINT_SYS_SIZE " 更改这个窗口的大小。"
-    IDS_HINT_SYS_MINIMIZE " 将这个窗口折叠为一个图标。"
-    IDS_HINT_SYS_MAXIMIZE " 将这个窗口扩展到整个屏幕。"
-    IDS_HINT_SYS_CLOSE " 关闭这个窗口。"
-END
diff --git a/base/applications/mscutils/devmgmt/mainwnd.c b/base/applications/mscutils/devmgmt/mainwnd.c
deleted file mode 100644 (file)
index c16f49a..0000000
+++ /dev/null
@@ -1,890 +0,0 @@
-/*
- * PROJECT:     ReactOS Device Managment
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        base/applications/mscutils/devmgmt/mainwnd.c
- * PURPOSE:     Main window message handler
- * COPYRIGHT:   Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
- *
- */
-
-#include "precomp.h"
-
-#include <windowsx.h>
-
-static BOOL pCreateToolbar(PMAIN_WND_INFO Info);
-
-static const TCHAR szMainWndClass[] = TEXT("DevMgmtWndClass");
-
-
-/* Toolbar buttons */
-TBBUTTON Buttons [] =
-{   /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
-    {TBICON_PROP,    IDC_PROP,    TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0},   /* properties */
-    {TBICON_REFRESH, IDC_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0},   /* refresh */
-
-    /* Note: First item for a seperator is its width in pixels */
-    {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},                           /* separator */
-
-    {TBICON_HELP,    IDC_PROGHELP,TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },  /* help */
-    {TBICON_EXIT,    IDC_EXIT,    TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },  /* exit */
-
-};
-
-
-/* menu hints */
-static const MENU_HINT MainMenuHintTable[] = {
-    /* File Menu */
-    {IDC_EXIT,     IDS_HINT_EXIT},
-
-    /* Action Menu */
-    {IDC_REFRESH,  IDS_HINT_REFRESH},
-    {IDC_PROP,     IDS_HINT_PROP},
-
-    /* Help Menu */
-    {IDC_PROGHELP, IDS_HINT_HELP},
-    {IDC_ABOUT,    IDS_HINT_ABOUT}
-};
-
-/* system menu hints */
-static const MENU_HINT SystemMenuHintTable[] = {
-    {SC_RESTORE,    IDS_HINT_SYS_RESTORE},
-    {SC_MOVE,       IDS_HINT_SYS_MOVE},
-    {SC_SIZE,       IDS_HINT_SYS_SIZE},
-    {SC_MINIMIZE,   IDS_HINT_SYS_MINIMIZE},
-    {SC_MAXIMIZE,   IDS_HINT_SYS_MAXIMIZE},
-    {SC_CLOSE,      IDS_HINT_SYS_CLOSE},
-};
-
-
-static BOOL
-MainWndMenuHint(PMAIN_WND_INFO Info,
-                WORD CmdId,
-                const MENU_HINT *HintArray,
-                DWORD HintsCount,
-                UINT DefHintId)
-{
-    BOOL Found = FALSE;
-    const MENU_HINT *LastHint;
-    UINT HintId = DefHintId;
-
-    LastHint = HintArray + HintsCount;
-    while (HintArray != LastHint)
-    {
-        if (HintArray->CmdId == CmdId)
-        {
-            HintId = HintArray->HintId;
-            Found = TRUE;
-            break;
-        }
-        HintArray++;
-    }
-
-    StatusBarLoadString(Info->hStatus,
-                        SB_SIMPLEID,
-                        hInstance,
-                        HintId);
-
-    return Found;
-}
-
-
-static VOID
-UpdateMainStatusBar(PMAIN_WND_INFO Info)
-{
-    if (Info->hStatus != NULL)
-    {
-        SendMessage(Info->hStatus,
-                    SB_SIMPLE,
-                    (WPARAM)Info->InMenuLoop,
-                    0);
-    }
-}
-
-
-static BOOL
-pCreateToolbar(PMAIN_WND_INFO Info)
-{
-    INT NumButtons = sizeof(Buttons) / sizeof(Buttons[0]);
-
-    Info->hTool = CreateWindowEx(0,
-                                 TOOLBARCLASSNAME,
-                                 NULL,
-                                 WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS,
-                                 0, 0, 0, 0,
-                                 Info->hMainWnd,
-                                 (HMENU)IDC_TOOLBAR,
-                                 hInstance,
-                                 NULL);
-    if(Info->hTool != NULL)
-    {
-        HIMAGELIST hImageList;
-
-        SendMessage(Info->hTool,
-                    TB_SETEXTENDEDSTYLE,
-                    0,
-                    TBSTYLE_EX_HIDECLIPPEDBUTTONS);
-
-        SendMessage(Info->hTool,
-                    TB_BUTTONSTRUCTSIZE,
-                    sizeof(Buttons[0]),
-                    0);
-
-        hImageList = InitImageList(IDB_PROP,
-                                   IDB_EXIT,
-                                   16,
-                                   16);
-        if (hImageList == NULL)
-            return FALSE;
-
-        ImageList_Destroy((HIMAGELIST)SendMessage(Info->hTool,
-                                                  TB_SETIMAGELIST,
-                                                  0,
-                                                  (LPARAM)hImageList));
-
-        SendMessage(Info->hTool,
-                    TB_ADDBUTTONS,
-                    NumButtons,
-                    (LPARAM)Buttons);
-
-        return TRUE;
-    }
-
-    return FALSE;
-}
-
-
-static BOOL
-CreateTreeView(PMAIN_WND_INFO Info)
-{
-    Info->hTreeView = CreateWindowEx(WS_EX_CLIENTEDGE,
-                                     WC_TREEVIEW,
-                                     NULL,
-                                     WS_CHILD | WS_VISIBLE | WS_BORDER | TVS_HASLINES |
-                                      TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_LINESATROOT,
-                                     0, 0, 0, 0,
-                                     Info->hMainWnd,
-                                     (HMENU)IDC_TREEVIEW,
-                                     hInstance,
-                                     NULL);
-    if (Info->hTreeView == NULL)
-    {
-        DisplayString(_T("Could not create TreeView."));
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
-static BOOL
-CreateStatusBar(PMAIN_WND_INFO Info)
-{
-    INT StatWidths[] = {110, -1}; /* widths of status bar */
-
-    Info->hStatus = CreateWindowEx(0,
-                                   STATUSCLASSNAME,
-                                   NULL,
-                                   WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP,
-                                   0, 0, 0, 0,
-                                   Info->hMainWnd,
-                                   (HMENU)IDC_STATUSBAR,
-                                   hInstance,
-                                   NULL);
-    if(Info->hStatus == NULL)
-        return FALSE;
-
-
-    SendMessage(Info->hStatus,
-                SB_SETPARTS,
-                sizeof(StatWidths) / sizeof(INT),
-                (LPARAM)StatWidths);
-
-    return TRUE;
-}
-
-
-static DWORD WINAPI
-DeviceEnumThread(LPVOID lpParameter)
-{
-    PMAIN_WND_INFO Info;
-    HTREEITEM hRoot;
-
-    Info = (PMAIN_WND_INFO)lpParameter;
-
-    if (Info->hTreeView)
-        FreeDeviceStrings(Info->hTreeView);
-
-    hRoot = InitTreeView(Info->hTreeView);
-    if (hRoot)
-    {
-        switch (Info->Display)
-        {
-            case DevicesByType:
-                ListDevicesByType(Info->hTreeView, hRoot, Info->bShowHidden);
-                break;
-
-            case DevicesByConnection:
-                ListDevicesByConnection(Info->hTreeView, hRoot, Info->bShowHidden);
-                break;
-
-            default:
-                break;
-        }
-        return 0;
-    }
-
-    return -1;
-}
-
-
-static VOID
-UpdateViewMenu(PMAIN_WND_INFO Info)
-{
-    UINT id = IDC_DEVBYTYPE;
-    HMENU hMenu;
-
-    hMenu = GetMenu(Info->hMainWnd);
-
-    switch (Info->Display)
-    {
-        case DevicesByType:
-            id = IDC_DEVBYTYPE;
-            break;
-        case DevicesByConnection:
-            id = IDC_DEVBYCONN;
-            break;
-        case RessourcesByType:
-            id = IDC_RESBYTYPE;
-            break;
-        case RessourcesByConnection:
-            id = IDC_RESBYCONN;
-            break;
-    }
-
-    CheckMenuRadioItem(hMenu,
-                       IDC_DEVBYTYPE,
-                       IDC_RESBYCONN,
-                       id,
-                       MF_BYCOMMAND);
-
-    CheckMenuItem(hMenu,
-                  IDC_SHOWHIDDEN,
-                  MF_BYCOMMAND | (Info->bShowHidden ? MF_CHECKED : MF_UNCHECKED));
-}
-
-
-static BOOL
-InitMainWnd(PMAIN_WND_INFO Info)
-{
-    HANDLE DevEnumThread;
-    HMENU hMenu;
-
-    if (!pCreateToolbar(Info))
-        DisplayString(_T("error creating toolbar"));
-
-    if (!CreateTreeView(Info))
-    {
-        DisplayString(_T("error creating list view"));
-        return FALSE;
-    }
-
-    if (!CreateStatusBar(Info))
-        DisplayString(_T("error creating status bar"));
-
-    UpdateViewMenu(Info);
-
-    /* make 'properties' bold */
-    hMenu = GetMenu(Info->hMainWnd);
-    hMenu = GetSubMenu(hMenu, 1);
-    SetMenuDefaultItem(hMenu, IDC_PROP, FALSE);
-
-    /* Create Popup Menu */
-    Info->hShortcutMenu = LoadMenu(hInstance,
-                                   MAKEINTRESOURCE(IDR_POPUP));
-    Info->hShortcutMenu = GetSubMenu(Info->hShortcutMenu,
-                                     0);
-    SetMenuDefaultItem(Info->hShortcutMenu, IDC_PROP, FALSE);
-
-    /* create separate thread to emum devices */
-    DevEnumThread = CreateThread(NULL,
-                                 0,
-                                 DeviceEnumThread,
-                                 Info,
-                                 0,
-                                 NULL);
-    if (!DevEnumThread)
-    {
-        DisplayString(_T("Failed to enumerate devices"));
-        return FALSE;
-    }
-
-    CloseHandle(DevEnumThread);
-    return TRUE;
-}
-
-
-static VOID
-OnContext(PMAIN_WND_INFO Info,
-          LPARAM lParam)
-{
-    HTREEITEM hSelected;
-    POINT pt;
-    RECT rc;
-
-    INT xPos = GET_X_LPARAM(lParam);
-    INT yPos = GET_Y_LPARAM(lParam);
-
-    hSelected = TreeView_GetSelection(Info->hTreeView);
-
-    if (TreeView_GetItemRect(Info->hTreeView,
-                         hSelected,
-                         &rc,
-                         TRUE))
-    {
-        if (GetCursorPos(&pt) &&
-            ScreenToClient(Info->hTreeView, &pt) &&
-            PtInRect(&rc, pt))
-        {
-            TrackPopupMenuEx(Info->hShortcutMenu,
-                             TPM_RIGHTBUTTON,
-                             xPos,
-                             yPos,
-                             Info->hMainWnd,
-                             NULL);
-        }
-    }
-}
-
-
-static LRESULT
-OnNotify(PMAIN_WND_INFO Info,
-         LPARAM lParam)
-{
-    LPNMHDR pnmhdr = (LPNMHDR)lParam;
-    LRESULT ret = 0;
-
-    switch (pnmhdr->code)
-    {
-        case TVN_SELCHANGED:
-        {
-            LPNM_TREEVIEW pnmtv = (LPNM_TREEVIEW)lParam;
-
-            if (Info->Display == DevicesByType)
-            {
-                if (!TreeView_GetChild(Info->hTreeView,
-                                       pnmtv->itemNew.hItem))
-                {
-                    SendMessage(Info->hTool,
-                                TB_SETSTATE,
-                                IDC_PROP,
-                                (LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
-
-                    EnableMenuItem(GetMenu(Info->hMainWnd), IDC_PROP, MF_ENABLED);
-                    EnableMenuItem(Info->hShortcutMenu, IDC_PROP, MF_ENABLED);
-                }
-                else
-                {
-                    SendMessage(Info->hTool,
-                                TB_SETSTATE,
-                                IDC_PROP,
-                                (LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));
-
-                    EnableMenuItem(GetMenu(Info->hMainWnd), IDC_PROP, MF_GRAYED);
-                    EnableMenuItem(Info->hShortcutMenu, IDC_PROP, MF_GRAYED);
-                }
-            }
-            else if (Info->Display == DevicesByConnection)
-            {
-                if (pnmtv->itemNew.hItem == TreeView_GetRoot(Info->hTreeView))
-                {
-                    SendMessage(Info->hTool,
-                                TB_SETSTATE,
-                                IDC_PROP,
-                                (LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));
-
-                    EnableMenuItem(GetMenu(Info->hMainWnd), IDC_PROP, MF_GRAYED);
-                    EnableMenuItem(Info->hShortcutMenu, IDC_PROP, MF_GRAYED);
-                }
-                else
-                {
-                    SendMessage(Info->hTool,
-                                TB_SETSTATE,
-                                IDC_PROP,
-                                (LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
-
-                    EnableMenuItem(GetMenu(Info->hMainWnd), IDC_PROP, MF_ENABLED);
-                    EnableMenuItem(Info->hShortcutMenu, IDC_PROP, MF_ENABLED);
-                }
-            }
-        }
-        break;
-
-        case NM_RETURN:
-        {
-            HTREEITEM hSelected = TreeView_GetSelection(Info->hTreeView);
-            if (Info->Display == DevicesByType)
-            {
-                OpenPropSheet(Info->hTreeView, hSelected);
-            }
-            else if (Info->Display == DevicesByConnection)
-            {
-                if (hSelected != TreeView_GetRoot(Info->hTreeView))
-                {
-                    OpenPropSheet(Info->hTreeView, hSelected);
-                }
-            }    
-        }
-        break;
-        
-        case NM_DBLCLK:
-        {
-            HTREEITEM hSelected = TreeView_GetSelection(Info->hTreeView);
-            TV_HITTESTINFO HitTest;
-
-            if (Info->Display == DevicesByType)
-            {
-                if (!TreeView_GetChild(Info->hTreeView,
-                                       hSelected))
-                {
-                    if (GetCursorPos(&HitTest.pt) &&
-                        ScreenToClient(Info->hTreeView, &HitTest.pt))
-                    {
-                        if (TreeView_HitTest(Info->hTreeView, &HitTest))
-                        {
-                            if (HitTest.hItem == hSelected)
-                            {
-                                OpenPropSheet(Info->hTreeView,
-                                              hSelected);
-                                ret = TRUE;
-                            }
-                        }
-                    }
-                }
-            }
-            else if (Info->Display == DevicesByConnection)
-            {
-                if (hSelected != TreeView_GetRoot(Info->hTreeView))
-                {
-                    if (GetCursorPos(&HitTest.pt) &&
-                        ScreenToClient(Info->hTreeView, &HitTest.pt))
-                    {
-                        if (TreeView_HitTest(Info->hTreeView, &HitTest))
-                        {
-                            if (HitTest.hItem == hSelected)
-                            {
-                                OpenPropSheet(Info->hTreeView,
-                                              hSelected);
-                                ret = TRUE;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        break;
-
-        case NM_RCLICK:
-        {
-            TV_HITTESTINFO HitTest;
-
-            if (GetCursorPos(&HitTest.pt) &&
-                ScreenToClient(Info->hTreeView, &HitTest.pt))
-            {
-                if (TreeView_HitTest(Info->hTreeView, &HitTest))
-                    (void)TreeView_SelectItem(Info->hTreeView, HitTest.hItem);
-            }
-        }
-        break;
-
-        case TTN_GETDISPINFO:
-        {
-            LPTOOLTIPTEXT lpttt;
-            UINT idButton;
-
-            lpttt = (LPTOOLTIPTEXT)lParam;
-
-            idButton = (UINT)lpttt->hdr.idFrom;
-            switch (idButton)
-            {
-                case IDC_PROP:
-                    lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PROP);
-                break;
-
-                case IDC_REFRESH:
-                    lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_REFRESH);
-                break;
-
-                case IDC_PROGHELP:
-                    lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_HELP);
-                break;
-
-                case IDC_EXIT:
-                    lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EXIT);
-                break;
-            }
-        }
-        break;
-    }
-
-    return ret;
-}
-
-
-static VOID
-OnRefresh(PMAIN_WND_INFO Info)
-{
-    HANDLE DevEnumThread;
-
-    SendMessage(Info->hTool,
-                TB_SETSTATE,
-                IDC_PROP,
-                (LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));
-
-    EnableMenuItem(GetMenu(Info->hMainWnd), IDC_PROP, MF_GRAYED);
-    EnableMenuItem(Info->hShortcutMenu, IDC_PROP, MF_GRAYED);
-
-    /* create seperate thread to emum devices */
-    DevEnumThread = CreateThread(NULL,
-                                 0,
-                                 DeviceEnumThread,
-                                 Info,
-                                 0,
-                                 NULL);
-    if (!DevEnumThread)
-    {
-        DisplayString(_T("Failed to enumerate devices"));
-        return;
-    }
-
-    CloseHandle(DevEnumThread);
-}
-
-
-static VOID
-MainWndCommand(PMAIN_WND_INFO Info,
-               WORD CmdId,
-               HWND hControl)
-{
-    UNREFERENCED_PARAMETER(hControl);
-
-    switch (CmdId)
-    {
-        case IDC_PROP:
-        {
-            HTREEITEM hSelected = TreeView_GetSelection(Info->hTreeView);
-            OpenPropSheet(Info->hTreeView,
-                          hSelected);
-        }
-        break;
-
-        case IDC_REFRESH:
-        {
-            OnRefresh(Info);
-        }
-        break;
-
-        case IDC_PROGHELP:
-        {
-            DisplayString(_T("Help is not yet implemented\n"));
-            SetFocus(Info->hTreeView);
-        }
-        break;
-
-        case IDC_EXIT:
-        {
-            PostMessage(Info->hMainWnd,
-                        WM_CLOSE,
-                        0,
-                        0);
-        }
-        break;
-
-        case IDC_ABOUT:
-        {
-            DialogBox(hInstance,
-                      MAKEINTRESOURCE(IDD_ABOUTBOX),
-                      Info->hMainWnd,
-                      AboutDialogProc);
-
-            SetFocus(Info->hTreeView);
-        }
-        break;
-
-        case IDC_DEVBYTYPE:
-        {
-            Info->Display = DevicesByType;
-            UpdateViewMenu(Info);
-            OnRefresh(Info);
-        }
-        break;
-
-        case IDC_DEVBYCONN:
-        {
-            Info->Display = DevicesByConnection;
-            UpdateViewMenu(Info);
-            OnRefresh(Info);
-        }
-        break;
-
-        case IDC_SHOWHIDDEN:
-        {
-            Info->bShowHidden = !Info->bShowHidden;
-            UpdateViewMenu(Info);
-            OnRefresh(Info);
-        }
-        break;
-    }
-}
-
-
-static VOID CALLBACK
-MainWndResize(PMAIN_WND_INFO Info,
-              WORD cx,
-              WORD cy)
-{
-    RECT rcClient, rcTool, rcStatus;
-    int lvHeight, iToolHeight, iStatusHeight;
-
-    /* Size toolbar and get height */
-    SendMessage(Info->hTool, TB_AUTOSIZE, 0, 0);
-    GetWindowRect(Info->hTool, &rcTool);
-    iToolHeight = rcTool.bottom - rcTool.top;
-
-    /* Size status bar and get height */
-    SendMessage(Info->hStatus, WM_SIZE, 0, 0);
-    GetWindowRect(Info->hStatus, &rcStatus);
-    iStatusHeight = rcStatus.bottom - rcStatus.top;
-
-    /* Calculate remaining height and size list view */
-    GetClientRect(Info->hMainWnd, &rcClient);
-    lvHeight = rcClient.bottom - iToolHeight - iStatusHeight;
-    SetWindowPos(Info->hTreeView,
-                 NULL,
-                 0,
-                 iToolHeight,
-                 rcClient.right,
-                 lvHeight,
-                 SWP_NOZORDER);
-}
-
-
-static LRESULT CALLBACK
-MainWndProc(HWND hwnd,
-            UINT msg,
-            WPARAM wParam,
-            LPARAM lParam)
-{
-    PMAIN_WND_INFO Info;
-    LRESULT Ret = 0;
-
-    /* Get the window context */
-    Info = (PMAIN_WND_INFO)GetWindowLongPtr(hwnd,
-                                            GWLP_USERDATA);
-    if (Info == NULL && msg != WM_CREATE)
-    {
-        goto HandleDefaultMessage;
-    }
-
-    switch(msg)
-    {
-        case WM_CREATE:
-        {
-            Info = (PMAIN_WND_INFO)(((LPCREATESTRUCT)lParam)->lpCreateParams);
-
-            /* Initialize the main window context */
-            Info->hMainWnd = hwnd;
-
-            SetWindowLongPtr(hwnd,
-                             GWLP_USERDATA,
-                             (LONG_PTR)Info);
-
-            if (!InitMainWnd(Info))
-                SendMessage(hwnd, WM_CLOSE, 0, 0);
-
-            /* Show the window */
-            ShowWindow(hwnd,
-                       Info->nCmdShow);
-        }
-        break;
-
-        case WM_SETFOCUS:
-        {
-            if (Info->hTreeView != NULL)
-                SetFocus(Info->hTreeView);
-        }
-        break;
-
-        case WM_SIZE:
-        {
-            MainWndResize(Info,
-                          LOWORD(lParam),
-                          HIWORD(lParam));
-        }
-        break;
-
-        case WM_NOTIFY:
-        {
-            Ret = OnNotify(Info, lParam);
-        }
-        break;
-
-        case WM_CONTEXTMENU:
-        {
-            OnContext(Info, lParam);
-        }
-        break;
-
-        case WM_COMMAND:
-        {
-            MainWndCommand(Info,
-                           LOWORD(wParam),
-                           (HWND)lParam);
-            goto HandleDefaultMessage;
-        }
-
-        case WM_MENUSELECT:
-        {
-            if (Info->hStatus != NULL)
-            {
-                if (!MainWndMenuHint(Info,
-                                     LOWORD(wParam),
-                                     MainMenuHintTable,
-                                     sizeof(MainMenuHintTable) / sizeof(MainMenuHintTable[0]),
-                                     IDS_HINT_BLANK))
-                {
-                    MainWndMenuHint(Info,
-                                    LOWORD(wParam),
-                                    SystemMenuHintTable,
-                                    sizeof(SystemMenuHintTable) / sizeof(SystemMenuHintTable[0]),
-                                    IDS_HINT_BLANK);
-                }
-            }
-        }
-        break;
-
-        case WM_ENTERMENULOOP:
-        {
-            Info->InMenuLoop = TRUE;
-            UpdateMainStatusBar(Info);
-            break;
-        }
-
-        case WM_EXITMENULOOP:
-        {
-            Info->InMenuLoop = FALSE;
-            UpdateMainStatusBar(Info);
-            break;
-        }
-
-        case WM_CLOSE:
-        {
-            FreeDeviceStrings(Info->hTreeView);
-            DestroyMenu(Info->hShortcutMenu);
-            DestroyWindow(hwnd);
-        }
-        break;
-
-        case WM_DESTROY:
-        {
-            HeapFree(ProcessHeap,
-                     0,
-                     Info);
-            SetWindowLongPtr(hwnd,
-                             GWLP_USERDATA,
-                             0);
-
-            /* Break the message queue loop */
-            PostQuitMessage(0);
-        }
-        break;
-
-        default:
-        {
-HandleDefaultMessage:
-
-            Ret = DefWindowProc(hwnd,
-                                msg,
-                                wParam,
-                                lParam);
-        }
-        break;
-    }
-    return Ret;
-}
-
-
-
-HWND
-CreateMainWindow(LPCTSTR lpCaption,
-                 int nCmdShow)
-{
-    PMAIN_WND_INFO Info;
-    HWND hMainWnd = NULL;
-
-    Info = (PMAIN_WND_INFO)HeapAlloc(ProcessHeap,
-                                     HEAP_ZERO_MEMORY,
-                                     sizeof(MAIN_WND_INFO));
-
-    if (Info != NULL)
-    {
-        Info->nCmdShow = nCmdShow;
-        Info->Display = DevicesByType;
-        Info->bShowHidden = TRUE;
-
-        hMainWnd = CreateWindowEx(WS_EX_WINDOWEDGE,
-                                  szMainWndClass,
-                                  lpCaption,
-                                  WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
-                                  CW_USEDEFAULT,
-                                  CW_USEDEFAULT,
-                                  600,
-                                  450,
-                                  NULL,
-                                  NULL,
-                                  hInstance,
-                                  Info);
-        if (hMainWnd == NULL)
-        {
-            GetError();
-            HeapFree(ProcessHeap,
-                     0,
-                     Info);
-        }
-    }
-
-    return hMainWnd;
-}
-
-BOOL
-InitMainWindowImpl(VOID)
-{
-    WNDCLASSEX wc = {0};
-
-    wc.cbSize = sizeof(WNDCLASSEX);
-    wc.lpfnWndProc = MainWndProc;
-    wc.hInstance = hInstance;
-    wc.hIcon = LoadIcon(hInstance,
-                        MAKEINTRESOURCE(IDI_MAIN_ICON));
-    wc.hCursor = LoadCursor(NULL,
-                            IDC_ARROW);
-    wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
-    wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU);
-    wc.lpszClassName = szMainWndClass;
-    wc.hIconSm = (HICON)LoadImage(hInstance,
-                                  MAKEINTRESOURCE(IDI_MAIN_ICON),
-                                  IMAGE_ICON,
-                                  16,
-                                  16,
-                                  LR_SHARED);
-
-    return RegisterClassEx(&wc) != (ATOM)0;
-}
-
-
-VOID
-UninitMainWindowImpl(VOID)
-{
-    UnregisterClass(szMainWndClass,
-                    hInstance);
-}
-
-
diff --git a/base/applications/mscutils/devmgmt/misc.c b/base/applications/mscutils/devmgmt/misc.c
deleted file mode 100644 (file)
index d2b7454..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * PROJECT:     ReactOS Device Managment
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        base/applications/mscutils/devmgmt/misc.c
- * PURPOSE:     miscallanous functions
- * COPYRIGHT:   Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
- *
- */
-
-#include "precomp.h"
-
-static INT
-LengthOfStrResource(IN HINSTANCE hInst,
-                    IN UINT uID)
-{
-    HRSRC hrSrc;
-    HGLOBAL hRes;
-    LPWSTR lpName, lpStr;
-
-    if (hInst == NULL)
-    {
-        return -1;
-    }
-
-    /* There are always blocks of 16 strings */
-    lpName = (LPWSTR)MAKEINTRESOURCE((uID >> 4) + 1);
-
-    /* Find the string table block */
-    if ((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) &&
-        (hRes = LoadResource(hInst, hrSrc)) &&
-        (lpStr = (LPWSTR)LockResource(hRes)))
-    {
-        UINT x;
-
-        /* Find the string we're looking for */
-        uID &= 0xF; /* position in the block, same as % 16 */
-        for (x = 0; x < uID; x++)
-        {
-            lpStr += (*lpStr) + 1;
-        }
-
-        /* Found the string */
-        return (int)(*lpStr);
-    }
-    return -1;
-}
-
-INT
-AllocAndLoadString(OUT LPTSTR *lpTarget,
-                   IN HINSTANCE hInst,
-                   IN UINT uID)
-{
-    INT ln;
-
-    ln = LengthOfStrResource(hInst,
-                             uID);
-    if (ln++ > 0)
-    {
-        (*lpTarget) = (LPTSTR)LocalAlloc(LMEM_FIXED,
-                                         ln * sizeof(TCHAR));
-        if ((*lpTarget) != NULL)
-        {
-            INT Ret;
-            if (!(Ret = LoadString(hInst, uID, *lpTarget, ln)))
-            {
-                LocalFree((HLOCAL)(*lpTarget));
-            }
-            return Ret;
-        }
-    }
-    return 0;
-}
-
-DWORD
-LoadAndFormatString(IN HINSTANCE hInstance,
-                    IN UINT uID,
-                    OUT LPTSTR *lpTarget,
-                    ...)
-{
-    DWORD Ret = 0;
-    LPTSTR lpFormat;
-    va_list lArgs;
-
-    if (AllocAndLoadString(&lpFormat,
-                           hInstance,
-                           uID) > 0)
-    {
-        va_start(lArgs, lpTarget);
-        /* let's use FormatMessage to format it because it has the ability to allocate
-           memory automatically */
-        Ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
-                            lpFormat,
-                            0,
-                            0,
-                            (LPTSTR)lpTarget,
-                            0,
-                            &lArgs);
-        va_end(lArgs);
-
-        LocalFree((HLOCAL)lpFormat);
-    }
-
-    return Ret;
-}
-
-BOOL
-StatusBarLoadAndFormatString(IN HWND hStatusBar,
-                             IN INT PartId,
-                             IN HINSTANCE hInstance,
-                             IN UINT uID,
-                             ...)
-{
-    BOOL Ret = FALSE;
-    LPTSTR lpFormat, lpStr;
-    va_list lArgs;
-
-    if (AllocAndLoadString(&lpFormat,
-                           hInstance,
-                           uID) > 0)
-    {
-        va_start(lArgs, uID);
-        /* let's use FormatMessage to format it because it has the ability to allocate
-           memory automatically */
-        Ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
-                            lpFormat,
-                            0,
-                            0,
-                            (LPTSTR)&lpStr,
-                            0,
-                            &lArgs);
-        va_end(lArgs);
-
-        if (lpStr != NULL)
-        {
-            Ret = (BOOL)SendMessage(hStatusBar,
-                                    SB_SETTEXT,
-                                    (WPARAM)PartId,
-                                    (LPARAM)lpStr);
-            LocalFree((HLOCAL)lpStr);
-        }
-
-        LocalFree((HLOCAL)lpFormat);
-    }
-
-    return Ret;
-}
-
-BOOL
-StatusBarLoadString(IN HWND hStatusBar,
-                    IN INT PartId,
-                    IN HINSTANCE hInstance,
-                    IN UINT uID)
-{
-    BOOL Ret = FALSE;
-    LPTSTR lpStr;
-
-    if (AllocAndLoadString(&lpStr,
-                           hInstance,
-                           uID) > 0)
-    {
-        Ret = (BOOL)SendMessage(hStatusBar,
-                                SB_SETTEXT,
-                                (WPARAM)PartId,
-                                (LPARAM)lpStr);
-        LocalFree((HLOCAL)lpStr);
-    }
-
-    return Ret;
-}
-
-
-INT
-GetTextFromEdit(OUT LPTSTR lpString,
-                IN HWND hDlg,
-                IN UINT Res)
-{
-    INT len = GetWindowTextLength(GetDlgItem(hDlg, Res));
-    if(len > 0)
-    {
-        GetDlgItemText(hDlg,
-                       Res,
-                       lpString,
-                       len + 1);
-    }
-    else
-        lpString = NULL;
-
-    return len;
-}
-
-
-HIMAGELIST
-InitImageList(UINT StartResource,
-              UINT EndResource,
-              UINT Width,
-              UINT Height)
-{
-    HBITMAP hBitmap;
-    HIMAGELIST hImageList;
-    UINT i;
-    INT Ret;
-
-    /* Create the toolbar icon image list */
-    hImageList = ImageList_Create(Width,
-                                  Height,
-                                  ILC_MASK | ILC_COLOR24,
-                                  EndResource - StartResource,
-                                  0);
-    if (hImageList == NULL)
-        return NULL;
-
-    /* Add all icons to the image list */
-    for (i = StartResource; i <= EndResource; i++)
-    {
-        hBitmap = (HBITMAP)LoadImage(hInstance,
-                                     MAKEINTRESOURCE(i),
-                                     IMAGE_BITMAP,
-                                     Width,
-                                     Height,
-                                     LR_LOADTRANSPARENT);
-        if (hBitmap == NULL)
-            return NULL;
-
-        Ret = ImageList_AddMasked(hImageList,
-                                  hBitmap,
-                                  RGB(255, 0, 128));
-        if (Ret == -1)
-            return NULL;
-
-        DeleteObject(hBitmap);
-    }
-
-    return hImageList;
-}
-
-
-VOID GetError(VOID)
-{
-    LPVOID lpMsgBuf;
-
-    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                  FORMAT_MESSAGE_FROM_SYSTEM |
-                  FORMAT_MESSAGE_IGNORE_INSERTS,
-                  NULL,
-                  GetLastError(),
-                  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                  (LPTSTR) &lpMsgBuf,
-                  0,
-                  NULL );
-
-    MessageBox(NULL, lpMsgBuf, _T("Error!"), MB_OK | MB_ICONERROR);
-
-    LocalFree(lpMsgBuf);
-}
-
-
-VOID DisplayString(LPTSTR Msg)
-{
-    MessageBox(NULL, Msg, _T("Note!"), MB_ICONEXCLAMATION|MB_OK);
-}
diff --git a/base/applications/mscutils/devmgmt/precomp.h b/base/applications/mscutils/devmgmt/precomp.h
deleted file mode 100644 (file)
index 3813e99..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-#ifndef __DEVMGMT_PRECOMP_H
-#define __DEVMGMT_PRECOMP_H
-
-#include <stdarg.h>
-
-#include <windef.h>
-#include <winbase.h>
-#include <winuser.h>
-#include <winreg.h>
-#include <wingdi.h>
-#include <tchar.h>
-#include <setupapi.h>
-
-#include "resource.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable : 4100)
-#endif
-
-#define MAX_DEV_LEN 256
-
-typedef enum
-{
-    DevicesByType,
-    DevicesByConnection,
-    RessourcesByType,
-    RessourcesByConnection
-} DISPLAY_TYPE;
-
-typedef struct _MAIN_WND_INFO
-{
-    HWND  hMainWnd;
-    HWND  hTreeView;
-    HWND  hStatus;
-    HWND  hTool;
-    HWND  hProgDlg;
-    HMENU hShortcutMenu;
-    int   nCmdShow;
-
-    DISPLAY_TYPE Display;
-    BOOL bShowHidden;
-
-    /* status flags */
-    UINT InMenuLoop : 1;
-
-} MAIN_WND_INFO, *PMAIN_WND_INFO;
-
-
-typedef struct _DEVCLASS_ENTRY
-{
-    GUID ClassGuid;
-    INT ClassImage;
-    BOOL bUsed;
-    HTREEITEM hItem;
-} DEVCLASS_ENTRY, *PDEVCLASS_ENTRY;
-
-
-INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
-
-
-/* devmgmt.c */
-extern HINSTANCE hInstance;
-extern HANDLE ProcessHeap;
-
-/* mainwnd.c */
-typedef struct _MENU_HINT
-{
-    WORD CmdId;
-    UINT HintId;
-} MENU_HINT, *PMENU_HINT;
-
-BOOL InitMainWindowImpl(VOID);
-VOID UninitMainWindowImpl(VOID);
-HWND CreateMainWindow(LPCTSTR lpCaption, int nCmdShow);
-
-
-/* enumdevices.c */
-
-VOID FreeDeviceStrings(HWND hTreeView);
-VOID OpenPropSheet(HWND hTreeView, HTREEITEM hItem);
-HTREEITEM InitTreeView(HWND hTreeView);
-VOID ListDevicesByType(HWND hTreeView, HTREEITEM hRoot, BOOL bShowHidden);
-VOID ListDevicesByConnection(HWND hTreeView, HTREEITEM hRoot, BOOL bShowHidden);
-
-
-/* misc.c */
-INT AllocAndLoadString(OUT LPTSTR *lpTarget,
-                       IN HINSTANCE hInst,
-                       IN UINT uID);
-
-DWORD LoadAndFormatString(IN HINSTANCE hInstance,
-                          IN UINT uID,
-                          OUT LPTSTR *lpTarget,
-                          ...);
-
-BOOL StatusBarLoadAndFormatString(IN HWND hStatusBar,
-                                  IN INT PartId,
-                                  IN HINSTANCE hInstance,
-                                  IN UINT uID,
-                                  ...);
-
-BOOL StatusBarLoadString(IN HWND hStatusBar,
-                         IN INT PartId,
-                         IN HINSTANCE hInstance,
-                         IN UINT uID);
-
-INT GetTextFromEdit(OUT LPTSTR lpString,
-                    IN HWND hDlg,
-                    IN UINT Res);
-
-HIMAGELIST InitImageList(UINT NumButtons,
-                         UINT StartResource,
-                         UINT Width,
-                         UINT Height);
-
-VOID GetError(VOID);
-VOID DisplayString(LPTSTR);
-
-#endif /* __DEVMGMT_PRECOMP_H */
diff --git a/base/applications/mscutils/devmgmt/res/computer.ico b/base/applications/mscutils/devmgmt/res/computer.ico
deleted file mode 100644 (file)
index 56edfcb..0000000
Binary files a/base/applications/mscutils/devmgmt/res/computer.ico and /dev/null differ
diff --git a/base/applications/mscutils/devmgmt/res/exit.bmp b/base/applications/mscutils/devmgmt/res/exit.bmp
deleted file mode 100644 (file)
index 97381f1..0000000
Binary files a/base/applications/mscutils/devmgmt/res/exit.bmp and /dev/null differ
diff --git a/base/applications/mscutils/devmgmt/res/help.bmp b/base/applications/mscutils/devmgmt/res/help.bmp
deleted file mode 100644 (file)
index 4c958c2..0000000
Binary files a/base/applications/mscutils/devmgmt/res/help.bmp and /dev/null differ
diff --git a/base/applications/mscutils/devmgmt/res/properties.bmp b/base/applications/mscutils/devmgmt/res/properties.bmp
deleted file mode 100644 (file)
index 15e080e..0000000
Binary files a/base/applications/mscutils/devmgmt/res/properties.bmp and /dev/null differ
diff --git a/base/applications/mscutils/devmgmt/res/refresh.bmp b/base/applications/mscutils/devmgmt/res/refresh.bmp
deleted file mode 100644 (file)
index e7c12bb..0000000
Binary files a/base/applications/mscutils/devmgmt/res/refresh.bmp and /dev/null differ
diff --git a/base/applications/mscutils/devmgmt/res/root.bmp b/base/applications/mscutils/devmgmt/res/root.bmp
deleted file mode 100644 (file)
index e2734fb..0000000
Binary files a/base/applications/mscutils/devmgmt/res/root.bmp and /dev/null differ
diff --git a/base/applications/mscutils/devmgmt/resource.h b/base/applications/mscutils/devmgmt/resource.h
deleted file mode 100644 (file)
index 8d84aed..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#pragma once
-
-#define IDC_STATIC -1
-
-#define IDI_MAIN_ICON  50
-#define IDB_ROOT_IMAGE 51
-
-/* windows */
-#define IDC_TREEVIEW  1000
-#define IDC_TOOLBAR   1001
-#define IDC_STATUSBAR 1002
-
-/* commands */
-#define IDC_PROP     2000
-#define IDC_REFRESH  2001
-#define IDC_PRINT    2002
-#define IDC_PROGHELP 2003
-#define IDC_EXIT     2004
-#define IDC_ABOUT    4031
-
-/* menus */
-#define IDR_MAINMENU   102
-#define IDR_POPUP      103
-#define IDC_DEVBYTYPE  104
-#define IDC_DEVBYCONN  105
-#define IDC_RESBYTYPE  106
-#define IDC_RESBYCONN  107
-#define IDC_SHOWHIDDEN 108
-
-/* tooltips */
-#define IDS_TOOLTIP_PROP    6000
-#define IDS_TOOLTIP_REFRESH 6001
-#define IDS_TOOLTIP_HELP    6002
-#define IDS_TOOLTIP_EXIT    6003
-
-/* button bitmaps */
-#define IDB_PROP    10000
-#define IDB_REFRESH 10001
-#define IDB_HELP    10002
-#define IDB_EXIT    10003
-
-/* toolbar buttons */
-#define TBICON_PROP    0
-#define TBICON_REFRESH 1
-#define TBICON_HELP    2
-#define TBICON_EXIT    3
-
-/* about box info */
-#define IDD_ABOUTBOX     200
-#define IDC_LICENSE_EDIT 201
-#define IDS_APPNAME      202
-#define IDS_LICENSE      203
-
-
-/* menu hints */
-#define IDS_HINT_BLANK   20000
-#define IDS_HINT_REFRESH 20002
-#define IDS_HINT_PROP    20003
-#define IDS_HINT_HELP    20004
-#define IDS_HINT_ABOUT   20005
-#define IDS_HINT_EXIT    20006
-
-/* system menu hints */
-#define IDS_HINT_SYS_RESTORE  21001
-#define IDS_HINT_SYS_MOVE     21002
-#define IDS_HINT_SYS_SIZE     21003
-#define IDS_HINT_SYS_MINIMIZE 21004
-#define IDS_HINT_SYS_MAXIMIZE 21005
-#define IDS_HINT_SYS_CLOSE    21006
diff --git a/base/applications/rapps/aboutdlg.c b/base/applications/rapps/aboutdlg.c
deleted file mode 100644 (file)
index 932faa4..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/aboutdlg.c
- * PURPOSE:         About Dialog
- * PROGRAMMERS:     Dmitry Chapyshev (dmitry@reactos.org)
- */
-
-#include "rapps.h"
-
-static
-INT_PTR CALLBACK
-AboutDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
-{
-    switch (Msg)
-    {
-        case WM_COMMAND:
-        {
-            switch (LOWORD(wParam))
-            {
-                case IDOK:
-                    EndDialog(hDlg, LOWORD(wParam));
-                    break;
-            }
-        }
-        break;
-    }
-
-    return FALSE;
-}
-
-VOID
-ShowAboutDialog(VOID)
-{
-    DialogBox(hInst,
-              MAKEINTRESOURCE(IDD_ABOUT_DIALOG),
-              hMainWnd,
-              AboutDlgProc);
-}
diff --git a/base/applications/rapps/available.c b/base/applications/rapps/available.c
deleted file mode 100644 (file)
index b65586d..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/available.c
- * PURPOSE:         Functions for working with available applications
- * PROGRAMMERS:     Dmitry Chapyshev           (dmitry@reactos.org)
- *                  Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
- */
-
-#include "rapps.h"
-
-#define ADD_TEXT(a, b, c, d) \
-    if (b[0] != '\0') \
-    { \
-        LoadStringW(hInst, a, szText, _countof(szText)); \
-        InsertRichEditText(szText, c); \
-        InsertRichEditText(b, d); \
-    } \
-
-#define GET_STRING1(a, b)  \
-    if (!ParserGetString(a, b, MAX_PATH, FindFileData.cFileName)) \
-        continue;
-
-#define GET_STRING2(a, b)  \
-    if (!ParserGetString(a, b, MAX_PATH, FindFileData.cFileName)) \
-        b[0] = '\0';
-
-LIST_ENTRY CachedEntriesHead = { &CachedEntriesHead, &CachedEntriesHead };
-PLIST_ENTRY pCachedEntry = &CachedEntriesHead;
-
-BOOL
-ShowAvailableAppInfo(INT Index)
-{
-    PAPPLICATION_INFO Info = (PAPPLICATION_INFO) ListViewGetlParam(Index);
-    WCHAR szText[MAX_STR_LEN];
-
-    if (!Info) return FALSE;
-
-    NewRichEditText(Info->szName, CFE_BOLD);
-
-    InsertRichEditText(L"\n", 0);
-
-    ADD_TEXT(IDS_AINFO_VERSION,     Info->szVersion, CFE_BOLD, 0);
-    ADD_TEXT(IDS_AINFO_LICENSE,     Info->szLicense, CFE_BOLD, 0);
-    ADD_TEXT(IDS_AINFO_SIZE,        Info->szSize,    CFE_BOLD, 0);
-    ADD_TEXT(IDS_AINFO_URLSITE,     Info->szUrlSite, CFE_BOLD, CFE_LINK);
-    ADD_TEXT(IDS_AINFO_DESCRIPTION, Info->szDesc,    CFE_BOLD, 0);
-
-    return TRUE;
-}
-
-static BOOL
-DeleteCurrentAppsDB(VOID)
-{
-    HANDLE hFind = INVALID_HANDLE_VALUE;
-    WIN32_FIND_DATAW FindFileData;
-    WCHAR szCabPath[MAX_PATH];
-    WCHAR szSearchPath[MAX_PATH];
-    WCHAR szPath[MAX_PATH];
-    WCHAR szTmp[MAX_PATH];
-    HRESULT hr;
-    BOOL result = TRUE;
-
-    if (!GetStorageDirectory(szPath, _countof(szPath)))
-        return FALSE;
-
-    hr = StringCbPrintfW(szCabPath, sizeof(szCabPath),
-                         L"%ls\\rappmgr.cab",
-                         szPath);
-    if (FAILED(hr))
-        return FALSE;
-
-    result = result && DeleteFileW(szCabPath);
-
-    hr = StringCbCatW(szPath, sizeof(szPath), L"\\rapps\\");
-
-    if (FAILED(hr))
-        return FALSE;
-
-    hr = StringCbPrintfW(szSearchPath, sizeof(szSearchPath),
-                         L"%ls*.txt",
-                         szPath);
-    if (FAILED(hr))
-        return FALSE;
-
-    hFind = FindFirstFileW(szSearchPath, &FindFileData);
-
-    if (hFind == INVALID_HANDLE_VALUE)
-        return result;
-
-    do
-    {
-        hr = StringCbPrintfW(szTmp, sizeof(szTmp),
-                             L"%ls%ls",
-                             szPath, FindFileData.cFileName);
-        if (FAILED(hr))
-            continue;
-        result = result && DeleteFileW(szTmp);
-
-    } while (FindNextFileW(hFind, &FindFileData) != 0);
-
-    FindClose(hFind);
-
-    return result;
-}
-
-
-BOOL
-UpdateAppsDB(VOID)
-{
-    WCHAR szPath[MAX_PATH];
-    WCHAR szAppsPath[MAX_PATH];
-    WCHAR szCabPath[MAX_PATH];
-
-    if (!DeleteCurrentAppsDB())
-        return FALSE;
-
-    DownloadApplicationsDB(APPLICATION_DATABASE_URL);
-
-    if (!GetStorageDirectory(szPath, _countof(szPath)))
-        return FALSE;
-
-    if (FAILED(StringCbPrintfW(szCabPath, sizeof(szCabPath),
-                               L"%ls\\rappmgr.cab",
-                               szPath)))
-    {
-        return FALSE;
-    }
-
-    if (FAILED(StringCbPrintfW(szAppsPath, sizeof(szAppsPath),
-                               L"%ls\\rapps\\",
-                               szPath)))
-    {
-        return FALSE;
-    }
-
-    ExtractFilesFromCab(szCabPath, szAppsPath);
-
-    return TRUE;
-}
-
-
-BOOL
-EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc)
-{
-    HANDLE hFind = INVALID_HANDLE_VALUE;
-    WIN32_FIND_DATAW FindFileData;
-    WCHAR szPath[MAX_PATH];
-    WCHAR szAppsPath[MAX_PATH];
-    WCHAR szCabPath[MAX_PATH];
-    PAPPLICATION_INFO Info;
-    HRESULT hr;
-
-    if (!GetStorageDirectory(szPath, _countof(szPath)))
-        return FALSE;
-
-    hr = StringCbPrintfW(szCabPath, sizeof(szCabPath),
-                         L"%ls\\rappmgr.cab",
-                         szPath);
-    if (FAILED(hr))
-        return FALSE;
-
-    hr = StringCbCatW(szPath, sizeof(szPath), L"\\rapps\\");
-
-    if (FAILED(hr))
-        return FALSE;
-
-    hr = StringCbCopyW(szAppsPath, sizeof(szAppsPath), szPath);
-
-    if (FAILED(hr))
-        return FALSE;
-
-    if (!CreateDirectory(szPath, NULL) &&
-        GetLastError() != ERROR_ALREADY_EXISTS)
-    {
-        return FALSE;
-    }
-
-    hr = StringCbCatW(szPath, sizeof(szPath), L"*.txt");
-
-    if (FAILED(hr))
-        return FALSE;
-
-    hFind = FindFirstFileW(szPath, &FindFileData);
-
-    if (hFind == INVALID_HANDLE_VALUE)
-    {
-        if (GetFileAttributesW(szCabPath) == INVALID_FILE_ATTRIBUTES)
-            DownloadApplicationsDB(APPLICATION_DATABASE_URL);
-
-        ExtractFilesFromCab(szCabPath, szAppsPath);
-        hFind = FindFirstFileW(szPath, &FindFileData);
-
-        if (hFind == INVALID_HANDLE_VALUE)
-            return FALSE;
-    }
-
-    do
-    {
-        /* loop for all the cached entries */
-        for (pCachedEntry = CachedEntriesHead.Flink; pCachedEntry != &CachedEntriesHead; pCachedEntry = pCachedEntry->Flink)
-        {
-            Info = CONTAINING_RECORD(pCachedEntry, APPLICATION_INFO, List);
-
-            /* do we already have this entry in cache? */
-            if(_wcsicmp(FindFileData.cFileName, Info->cFileName) == 0)
-            {
-                /* is it current enough, or the file has been modified since our last time here? */
-                if (CompareFileTime(&FindFileData.ftLastWriteTime, &Info->ftCacheStamp) == 1)
-                {
-                    /* recreate our cache, this is the slow path */
-                    RemoveEntryList(&Info->List);
-                    HeapFree(GetProcessHeap(), 0, Info);
-                }
-                else
-                {
-                    /* speedy path, compare directly, we already have the data */
-                    goto skip_if_cached;
-                }
-
-                break;
-            }
-        }
-
-        /* create a new entry */
-        Info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(APPLICATION_INFO));
-
-        if(!Info)
-            break;
-
-        Info->Category = ParserGetInt(L"Category", FindFileData.cFileName);
-
-        /* copy the cache-related fields for the next time */
-        RtlCopyMemory(&Info->cFileName,    &FindFileData.cFileName, MAX_PATH);
-        RtlCopyMemory(&Info->ftCacheStamp, &FindFileData.ftLastWriteTime, sizeof(FILETIME));
-
-        /* add our cached entry to the cached list */
-        InsertTailList(&CachedEntriesHead, &Info->List);
-
-skip_if_cached:
-
-        if (Info->Category == FALSE)
-            continue;
-
-        if (EnumType != Info->Category && EnumType != ENUM_ALL_AVAILABLE)
-            continue;
-
-        /* if our cache hit was only partial, we need to parse
-           and lazily fill the rest of fields only when needed */
-
-        if (Info->szUrlDownload[0] == 0)
-        {
-            GET_STRING1(L"Name",        Info->szName);
-            GET_STRING1(L"URLDownload", Info->szUrlDownload);
-
-            GET_STRING2(L"RegName",     Info->szRegName);
-            GET_STRING2(L"Version",     Info->szVersion);
-            GET_STRING2(L"License",     Info->szLicense);
-            GET_STRING2(L"Description", Info->szDesc);
-            GET_STRING2(L"Size",        Info->szSize);
-            GET_STRING2(L"URLSite",     Info->szUrlSite);
-            GET_STRING2(L"CDPath",      Info->szCDPath);
-            GET_STRING2(L"SHA1",        Info->szSHA1);
-        }
-
-        if (!lpEnumProc(Info))
-            break;
-
-    } while (FindNextFileW(hFind, &FindFileData) != 0);
-
-    FindClose(hFind);
-
-    return TRUE;
-}
-
-VOID FreeCachedAvailableEntries(VOID)
-{
-     PAPPLICATION_INFO Info;
-    /* loop and deallocate all the cached app infos in the list */
-    for (pCachedEntry = CachedEntriesHead.Flink; pCachedEntry != &CachedEntriesHead;)
-    {
-         Info = CONTAINING_RECORD(pCachedEntry, APPLICATION_INFO, List);
-        /* grab a reference to the next linked entry before getting rid of the current one */
-        pCachedEntry = pCachedEntry->Flink;
-        /* flush them down the toilet :D */
-        RemoveEntryList(&Info->List);
-        HeapFree(GetProcessHeap(), 0, Info);
-    }
-}
\ No newline at end of file
diff --git a/base/applications/rapps/installdlg.c b/base/applications/rapps/installdlg.c
deleted file mode 100644 (file)
index d1960e2..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/installdlg.c
- * PURPOSE:         "Download and Install" Dialog
- * PROGRAMMERS:     Dmitry Chapyshev (dmitry@reactos.org)
- */
-
-#include "rapps.h"
-
-static PAPPLICATION_INFO AppInfo;
-
-static
-INT_PTR CALLBACK
-InstallDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
-{
-    switch (Msg)
-    {
-        case WM_INITDIALOG:
-        {
-
-        }
-        break;
-
-        case WM_COMMAND:
-        {
-            switch (LOWORD(wParam))
-            {
-                case IDOK:
-                case IDCANCEL:
-                    EndDialog(hDlg, LOWORD(wParam));
-                break;
-            }
-        }
-        break;
-    }
-
-    return FALSE;
-}
-
-BOOL
-InstallApplication(INT Index)
-{
-    if (!IS_AVAILABLE_ENUM(SelectedEnumType))
-        return FALSE;
-
-    AppInfo = (PAPPLICATION_INFO) ListViewGetlParam(Index);
-    if (!AppInfo) return FALSE;
-
-    DialogBox(hInst,
-              MAKEINTRESOURCE(IDD_INSTALL_DIALOG),
-              hMainWnd,
-              InstallDlgProc);
-
-    return TRUE;
-}
diff --git a/base/applications/rapps/installed.c b/base/applications/rapps/installed.c
deleted file mode 100644 (file)
index 2bdf69e..0000000
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/installed.c
- * PURPOSE:         Functions for working with installed applications
- * PROGRAMMERS:     Dmitry Chapyshev (dmitry@reactos.org)
- */
-
-#include "rapps.h"
-
-BOOL
-GetApplicationString(HKEY hKey, LPWSTR lpKeyName, LPWSTR lpString)
-{
-    DWORD dwSize = MAX_PATH * sizeof(WCHAR);
-
-    if (RegQueryValueExW(hKey,
-                         lpKeyName,
-                         NULL,
-                         NULL,
-                         (LPBYTE)lpString,
-                         &dwSize) == ERROR_SUCCESS)
-    {
-        return TRUE;
-    }
-
-    (VOID)StringCchCopyW(lpString, MAX_PATH, L"---");
-
-    return FALSE;
-}
-
-
-BOOL
-IsInstalledApplication(LPWSTR lpRegName, BOOL IsUserKey)
-{
-    DWORD dwSize = MAX_PATH, dwType;
-    WCHAR szName[MAX_PATH];
-    WCHAR szDisplayName[MAX_PATH];
-    HKEY hKey, hSubKey;
-    INT ItemIndex = 0;
-
-    if (RegOpenKeyW(IsUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
-                    L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
-                    &hKey) != ERROR_SUCCESS)
-    {
-        return FALSE;
-    }
-
-    while (RegEnumKeyExW(hKey, ItemIndex, szName, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
-    {
-        if (RegOpenKeyW(hKey, szName, &hSubKey) == ERROR_SUCCESS)
-        {
-            dwType = REG_SZ;
-            dwSize = sizeof(szDisplayName);
-            if (RegQueryValueExW(hSubKey,
-                                 L"DisplayName",
-                                 NULL,
-                                 &dwType,
-                                 (LPBYTE)szDisplayName,
-                                 &dwSize) == ERROR_SUCCESS)
-            {
-                if (wcscmp(szDisplayName, lpRegName) == 0)
-                {
-                    RegCloseKey(hSubKey);
-                    RegCloseKey(hKey);
-                    return TRUE;
-                }
-            }
-        }
-
-        RegCloseKey(hSubKey);
-        dwSize = MAX_PATH;
-        ItemIndex++;
-    }
-
-    RegCloseKey(hKey);
-    return FALSE;
-}
-
-
-BOOL
-UninstallApplication(INT Index, BOOL bModify)
-{
-    WCHAR szModify[] = L"ModifyPath";
-    WCHAR szUninstall[] = L"UninstallString";
-    WCHAR szPath[MAX_PATH];
-    WCHAR szAppName[MAX_STR_LEN];
-    DWORD dwType, dwSize;
-    INT ItemIndex;
-    LVITEM Item;
-    HKEY hKey;
-    PINSTALLED_INFO ItemInfo;
-
-    if (!IS_INSTALLED_ENUM(SelectedEnumType))
-        return FALSE;
-
-    if (Index == -1)
-    {
-        ItemIndex = (INT) SendMessageW(hListView, LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
-        if (ItemIndex == -1)
-            return FALSE;
-    }
-    else
-    {
-        ItemIndex = Index;
-    }
-
-    ListView_GetItemText(hListView, ItemIndex, 0, szAppName, _countof(szAppName));
-    WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_REMOVE, szAppName);
-
-    ZeroMemory(&Item, sizeof(Item));
-
-    Item.mask = LVIF_PARAM;
-    Item.iItem = ItemIndex;
-    if (!ListView_GetItem(hListView, &Item))
-        return FALSE;
-
-    ItemInfo = (PINSTALLED_INFO)Item.lParam;
-    hKey = ItemInfo->hSubKey;
-
-    dwType = REG_SZ;
-    dwSize = sizeof(szPath);
-    if (RegQueryValueExW(hKey,
-                         bModify ? szModify : szUninstall,
-                         NULL,
-                         &dwType,
-                         (LPBYTE)szPath,
-                         &dwSize) != ERROR_SUCCESS)
-    {
-        return FALSE;
-    }
-
-    return StartProcess(szPath, TRUE);
-}
-
-
-BOOL
-ShowInstalledAppInfo(INT Index)
-{
-    WCHAR szText[MAX_PATH], szInfo[MAX_PATH];
-    PINSTALLED_INFO Info = ListViewGetlParam(Index);
-
-    if (!Info || !Info->hSubKey) return FALSE;
-
-    GetApplicationString(Info->hSubKey, L"DisplayName", szText);
-    NewRichEditText(szText, CFE_BOLD);
-
-    InsertRichEditText(L"\n", 0);
-
-#define GET_INFO(a, b, c, d) \
-    if (GetApplicationString(Info->hSubKey, a, szInfo)) \
-    { \
-        LoadStringW(hInst, b, szText, _countof(szText)); \
-        InsertRichEditText(szText, c); \
-        InsertRichEditText(szInfo, d); \
-    } \
-
-    GET_INFO(L"DisplayVersion", IDS_INFO_VERSION, CFE_BOLD, 0);
-    GET_INFO(L"Publisher", IDS_INFO_PUBLISHER, CFE_BOLD, 0);
-    GET_INFO(L"RegOwner", IDS_INFO_REGOWNER, CFE_BOLD, 0);
-    GET_INFO(L"ProductID", IDS_INFO_PRODUCTID, CFE_BOLD, 0);
-    GET_INFO(L"HelpLink", IDS_INFO_HELPLINK, CFE_BOLD, CFM_LINK);
-    GET_INFO(L"HelpTelephone", IDS_INFO_HELPPHONE, CFE_BOLD, 0);
-    GET_INFO(L"Readme", IDS_INFO_README, CFE_BOLD, 0);
-    GET_INFO(L"Contact", IDS_INFO_CONTACT, CFE_BOLD, 0);
-    GET_INFO(L"URLUpdateInfo", IDS_INFO_UPDATEINFO, CFE_BOLD, CFM_LINK);
-    GET_INFO(L"URLInfoAbout", IDS_INFO_INFOABOUT, CFE_BOLD, CFM_LINK);
-    GET_INFO(L"Comments", IDS_INFO_COMMENTS, CFE_BOLD, 0);
-    GET_INFO(L"InstallDate", IDS_INFO_INSTALLDATE, CFE_BOLD, 0);
-    GET_INFO(L"InstallLocation", IDS_INFO_INSTLOCATION, CFE_BOLD, 0);
-    GET_INFO(L"InstallSource", IDS_INFO_INSTALLSRC, CFE_BOLD, 0);
-    GET_INFO(L"UninstallString", IDS_INFO_UNINSTALLSTR, CFE_BOLD, 0);
-    GET_INFO(L"InstallSource", IDS_INFO_INSTALLSRC, CFE_BOLD, 0);
-    GET_INFO(L"ModifyPath", IDS_INFO_MODIFYPATH, CFE_BOLD, 0);
-
-    return TRUE;
-}
-
-
-VOID
-RemoveAppFromRegistry(INT Index)
-{
-    PINSTALLED_INFO Info;
-    WCHAR szFullName[MAX_PATH] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\";
-    WCHAR szMsgText[MAX_STR_LEN], szMsgTitle[MAX_STR_LEN];
-    INT ItemIndex = SendMessage(hListView, LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
-
-    if (!IS_INSTALLED_ENUM(SelectedEnumType))
-        return;
-
-    Info = ListViewGetlParam(Index);
-    if (!Info || !Info->hSubKey || (ItemIndex == -1)) return;
-
-    if (!LoadStringW(hInst, IDS_APP_REG_REMOVE, szMsgText, _countof(szMsgText)) ||
-        !LoadStringW(hInst, IDS_INFORMATION, szMsgTitle, _countof(szMsgTitle)))
-        return;
-
-    if (MessageBoxW(hMainWnd, szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) == IDYES)
-    {
-        wcsncat(szFullName, Info->szKeyName, MAX_PATH - wcslen(szFullName));
-
-        if (RegDeleteKeyW(Info->hRootKey, szFullName) == ERROR_SUCCESS)
-        {
-            (VOID) ListView_DeleteItem(hListView, ItemIndex);
-            return;
-        }
-
-        if (!LoadStringW(hInst, IDS_UNABLE_TO_REMOVE, szMsgText, _countof(szMsgText)))
-            return;
-
-        MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);
-    }
-}
-
-
-BOOL
-EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc)
-{
-    DWORD dwSize = MAX_PATH, dwType, dwValue;
-    BOOL bIsSystemComponent, bIsUpdate;
-    WCHAR pszParentKeyName[MAX_PATH];
-    WCHAR pszDisplayName[MAX_PATH];
-    INSTALLED_INFO Info;
-    HKEY hKey;
-    LONG ItemIndex = 0;
-
-    Info.hRootKey = IsUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
-
-    if (RegOpenKeyW(Info.hRootKey,
-                    L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
-                    &hKey) != ERROR_SUCCESS)
-    {
-        return FALSE;
-    }
-
-    while (RegEnumKeyExW(hKey, ItemIndex, Info.szKeyName, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
-    {
-        if (RegOpenKeyW(hKey, Info.szKeyName, &Info.hSubKey) == ERROR_SUCCESS)
-        {
-            dwType = REG_DWORD;
-            dwSize = sizeof(DWORD);
-
-            if (RegQueryValueExW(Info.hSubKey,
-                                 L"SystemComponent",
-                                 NULL,
-                                 &dwType,
-                                 (LPBYTE)&dwValue,
-                                 &dwSize) == ERROR_SUCCESS)
-            {
-                bIsSystemComponent = (dwValue == 0x1);
-            }
-            else
-            {
-                bIsSystemComponent = FALSE;
-            }
-
-            dwType = REG_SZ;
-            dwSize = sizeof(pszParentKeyName);
-            bIsUpdate = (RegQueryValueExW(Info.hSubKey,
-                                          L"ParentKeyName",
-                                          NULL,
-                                          &dwType,
-                                          (LPBYTE)pszParentKeyName,
-                                          &dwSize) == ERROR_SUCCESS);
-
-            dwSize = sizeof(pszDisplayName);
-            if (RegQueryValueExW(Info.hSubKey,
-                                 L"DisplayName",
-                                 NULL,
-                                 &dwType,
-                                 (LPBYTE)pszDisplayName,
-                                 &dwSize) == ERROR_SUCCESS)
-            {
-                if (EnumType < ENUM_ALL_COMPONENTS || EnumType > ENUM_UPDATES)
-                    EnumType = ENUM_ALL_COMPONENTS;
-
-                if (!bIsSystemComponent)
-                {
-                    if ((EnumType == ENUM_ALL_COMPONENTS) || /* All components */
-                        ((EnumType == ENUM_APPLICATIONS) && (!bIsUpdate)) || /* Applications only */
-                        ((EnumType == ENUM_UPDATES) && (bIsUpdate))) /* Updates only */
-                    {
-                        if (!lpEnumProc(ItemIndex, pszDisplayName, &Info))
-                            break;
-                    }
-                    else
-                    {
-                        RegCloseKey(Info.hSubKey);
-                    }
-                }
-                else
-                {
-                    RegCloseKey(Info.hSubKey);
-                }
-            }
-            else
-            {
-                RegCloseKey(Info.hSubKey);
-            }
-        }
-
-        dwSize = MAX_PATH;
-        ItemIndex++;
-    }
-
-    RegCloseKey(hKey);
-
-    return TRUE;
-}
diff --git a/base/applications/rapps/listview.c b/base/applications/rapps/listview.c
deleted file mode 100644 (file)
index d4041e2..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/listview.c
- * PURPOSE:         ListView functions
- * PROGRAMMERS:     Dmitry Chapyshev (dmitry@reactos.org)
- */
-
-#include "rapps.h"
-
-HWND hListView;
-BOOL bAscending = TRUE;
-
-PVOID
-ListViewGetlParam(INT Index)
-{
-    INT ItemIndex;
-    LVITEM Item;
-
-    if (Index == -1)
-    {
-        ItemIndex = (INT) SendMessage(hListView, LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
-        if (ItemIndex == -1)
-            return NULL;
-    }
-    else
-    {
-        ItemIndex = Index;
-    }
-
-    ZeroMemory(&Item, sizeof(Item));
-
-    Item.mask = LVIF_PARAM;
-    Item.iItem = ItemIndex;
-    if (!ListView_GetItem(hListView, &Item))
-        return NULL;
-
-    return (PVOID)Item.lParam;
-}
-
-BOOL
-ListViewAddColumn(INT Index, LPWSTR lpText, INT Width, INT Format)
-{
-    LV_COLUMN Column;
-
-    ZeroMemory(&Column, sizeof(Column));
-
-    Column.mask     = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
-    Column.iSubItem = Index;
-    Column.pszText  = (LPTSTR)lpText;
-    Column.cx       = Width;
-    Column.fmt      = Format;
-
-    return (ListView_InsertColumn(hListView, Index, &Column) == -1) ? FALSE : TRUE;
-}
-
-INT
-ListViewAddItem(INT ItemIndex, INT IconIndex, LPWSTR lpText, LPARAM lParam)
-{
-    LV_ITEMW Item;
-
-    ZeroMemory(&Item, sizeof(Item));
-
-    Item.mask       = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
-    Item.pszText    = lpText;
-    Item.lParam     = lParam;
-    Item.iItem      = ItemIndex;
-    Item.iImage     = IconIndex;
-
-    return ListView_InsertItem(hListView, &Item);
-}
-
-INT
-CALLBACK
-ListViewCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
-{
-    WCHAR Item1[MAX_STR_LEN], Item2[MAX_STR_LEN];
-    LVFINDINFO IndexInfo;
-    INT Index;
-
-    IndexInfo.flags = LVFI_PARAM;
-
-    IndexInfo.lParam = lParam1;
-    Index = ListView_FindItem(hListView, -1, &IndexInfo);
-    ListView_GetItemText(hListView, Index, (INT)lParamSort, Item1, _countof(Item1));
-
-    IndexInfo.lParam = lParam2;
-    Index = ListView_FindItem(hListView, -1, &IndexInfo);
-    ListView_GetItemText(hListView, Index, (INT)lParamSort, Item2, _countof(Item2));
-
-    if (bAscending)
-        return wcscmp(Item2, Item1);
-    else
-        return wcscmp(Item1, Item2);
-
-    return 0;
-}
-
-BOOL
-CreateListView(HWND hwnd)
-{
-    hListView = CreateWindowExW(WS_EX_CLIENTEDGE,
-                                WC_LISTVIEWW,
-                                L"",
-                                WS_CHILD | WS_VISIBLE | LVS_SORTASCENDING | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS,
-                                205, 28, 465, 250,
-                                hwnd,
-                                GetSubMenu(LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_APPLICATIONMENU)), 0),
-                                hInst,
-                                NULL);
-
-    if (!hListView)
-    {
-        /* TODO: Show error message */
-        return FALSE;
-    }
-
-    (VOID) ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT);
-
-    return TRUE;
-}
diff --git a/base/applications/rapps/loaddlg.c b/base/applications/rapps/loaddlg.c
deleted file mode 100644 (file)
index bb398f8..0000000
+++ /dev/null
@@ -1,723 +0,0 @@
-/* PROJECT:     ReactOS Applications Manager
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        base/applications/rapps/loaddlg.c
- * PURPOSE:     Displaying a download dialog
- * COPYRIGHT:   Copyright 2001 John R. Sheets (for CodeWeavers)
- *              Copyright 2004 Mike McCormack (for CodeWeavers)
- *              Copyright 2005 Ge van Geldorp (gvg@reactos.org)
- *              Copyright 2009 Dmitry Chapyshev (dmitry@reactos.org)
- *              Copyright 2015 Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
- */
-/*
- * Based on Wine dlls/shdocvw/shdocvw_main.c
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include "rapps.h"
-#include <wininet.h>
-#include <shellapi.h>
-#include <windowsx.h>
-
-static PAPPLICATION_INFO AppInfo;
-
-typedef struct _IBindStatusCallbackImpl
-{
-    const IBindStatusCallbackVtbl *vtbl;
-    LONG ref;
-    HWND hDialog;
-    BOOL *pbCancelled;
-    BOOL UrlHasBeenCopied;
-    WCHAR ProgressText[MAX_PATH];
-} IBindStatusCallbackImpl;
-
-static
-HRESULT WINAPI
-dlQueryInterface(IBindStatusCallback* This, REFIID riid, void** ppvObject)
-{
-    if (!ppvObject) return E_POINTER;
-
-    if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IBindStatusCallback))
-    {
-        IBindStatusCallback_AddRef(This);
-        *ppvObject = This;
-        return S_OK;
-    }
-
-    return E_NOINTERFACE;
-}
-
-static
-ULONG WINAPI
-dlAddRef(IBindStatusCallback* iface)
-{
-    IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl*) iface;
-    return InterlockedIncrement(&This->ref);
-}
-
-static
-ULONG WINAPI
-dlRelease(IBindStatusCallback* iface)
-{
-    IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl*) iface;
-    DWORD ref = InterlockedDecrement(&This->ref);
-
-    if (!ref)
-    {
-        DestroyWindow(This->hDialog);
-        HeapFree(GetProcessHeap(), 0, This);
-    }
-
-    return ref;
-}
-
-static
-HRESULT WINAPI
-dlOnStartBinding(IBindStatusCallback* iface, DWORD dwReserved, IBinding* pib)
-{
-    return S_OK;
-}
-
-static
-HRESULT WINAPI
-dlGetPriority(IBindStatusCallback* iface, LONG* pnPriority)
-{
-    return S_OK;
-}
-
-static
-HRESULT WINAPI
-dlOnLowResource( IBindStatusCallback* iface, DWORD reserved)
-{
-    return S_OK;
-}
-
-static
-HRESULT WINAPI
-dlOnProgress(IBindStatusCallback* iface,
-             ULONG ulProgress,
-             ULONG ulProgressMax,
-             ULONG ulStatusCode,
-             LPCWSTR szStatusText)
-{
-    IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
-    HWND Item;
-    LONG r;
-
-    Item = GetDlgItem(This->hDialog, IDC_DOWNLOAD_PROGRESS);
-    if (Item && ulProgressMax)
-    {
-        WCHAR szProgress[100];
-        WCHAR szProgressMax[100];
-        UINT uiPercentage = ((ULONGLONG)ulProgress * 100) / ulProgressMax;
-
-        /* send the current progress to the progress bar */
-        SendMessageW(Item, PBM_SETPOS, uiPercentage, 0);
-
-        /* format the bits and bytes into pretty and accessible units... */
-        StrFormatByteSizeW(ulProgress, szProgress, _countof(szProgress));
-        StrFormatByteSizeW(ulProgressMax, szProgressMax, _countof(szProgressMax));
-
-        /* ...and post all of it to our subclassed progress bar text subroutine */
-        StringCbPrintfW(This->ProgressText,
-                        sizeof(This->ProgressText),
-                        L"%u%% \x2014 %ls / %ls",
-                        uiPercentage,
-                        szProgress,
-                        szProgressMax);
-        SendMessageW(Item, WM_SETTEXT, 0, (LPARAM)This->ProgressText);
-    }
-
-    Item = GetDlgItem(This->hDialog, IDC_DOWNLOAD_STATUS);
-    if (Item && szStatusText && wcslen(szStatusText) > 0 && This->UrlHasBeenCopied == FALSE)
-    {
-        DWORD len = wcslen(szStatusText) + 1;
-        PWSTR buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(WCHAR));
-
-        if (buf)
-        {
-            /* beautify our url for display purposes */
-            InternetCanonicalizeUrl(szStatusText, buf, &len, ICU_DECODE | ICU_NO_ENCODE);
-        }
-        else
-        {
-            /* just use the original */
-            buf = (PWSTR)szStatusText;
-        }
-
-        /* paste it into our dialog and don't do it again in this instance */
-        SendMessageW(Item, WM_SETTEXT, 0, (LPARAM)buf);
-        This->UrlHasBeenCopied = TRUE;
-
-        if (buf != szStatusText)
-        {
-            HeapFree(GetProcessHeap(), 0, buf);
-        }
-    }
-
-    SetLastError(0);
-    r = GetWindowLongPtrW(This->hDialog, GWLP_USERDATA);
-    if (0 != r || 0 != GetLastError())
-    {
-        *This->pbCancelled = TRUE;
-        return E_ABORT;
-    }
-
-    return S_OK;
-}
-
-static
-HRESULT WINAPI
-dlOnStopBinding(IBindStatusCallback* iface, HRESULT hresult, LPCWSTR szError)
-{
-    return S_OK;
-}
-
-static
-HRESULT WINAPI
-dlGetBindInfo(IBindStatusCallback* iface, DWORD* grfBINDF, BINDINFO* pbindinfo)
-{
-    return S_OK;
-}
-
-static
-HRESULT WINAPI
-dlOnDataAvailable(IBindStatusCallback* iface, DWORD grfBSCF,
-                DWORD dwSize, FORMATETC* pformatetc, STGMEDIUM* pstgmed)
-{
-    return S_OK;
-}
-
-static
-HRESULT WINAPI
-dlOnObjectAvailable(IBindStatusCallback* iface, REFIID riid, IUnknown* punk)
-{
-    return S_OK;
-}
-
-static const IBindStatusCallbackVtbl dlVtbl =
-{
-    dlQueryInterface,
-    dlAddRef,
-    dlRelease,
-    dlOnStartBinding,
-    dlGetPriority,
-    dlOnLowResource,
-    dlOnProgress,
-    dlOnStopBinding,
-    dlGetBindInfo,
-    dlOnDataAvailable,
-    dlOnObjectAvailable
-};
-
-static IBindStatusCallback*
-CreateDl(HWND Dlg, BOOL *pbCancelled)
-{
-    IBindStatusCallbackImpl *This;
-
-    This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IBindStatusCallbackImpl));
-    if (!This)
-        return NULL;
-
-    This->vtbl = &dlVtbl;
-    This->ref = 1;
-    This->hDialog = Dlg;
-    This->pbCancelled = pbCancelled;
-
-    return (IBindStatusCallback*) This;
-}
-
-#ifdef USE_CERT_PINNING
-static BOOL CertIsValid(HINTERNET hInternet, LPWSTR lpszHostName)
-{
-    HINTERNET hConnect;
-    HINTERNET hRequest;
-    DWORD certInfoLength;
-    BOOL Ret = FALSE;
-    INTERNET_CERTIFICATE_INFOW certInfo;
-
-    hConnect = InternetConnectW(hInternet, lpszHostName, INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, INTERNET_FLAG_SECURE, 0);
-    if (hConnect)
-    {
-        hRequest = HttpOpenRequestW(hConnect, L"HEAD", NULL, NULL, NULL, NULL, INTERNET_FLAG_SECURE, 0);
-        if (hRequest != NULL)
-        {
-            Ret = HttpSendRequestW(hRequest, L"", 0, NULL, 0);
-            if (Ret)
-            {
-                certInfoLength = sizeof(certInfo);
-                Ret = InternetQueryOptionW(hRequest,
-                                           INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
-                                           &certInfo,
-                                           &certInfoLength);
-                if (Ret)
-                {
-                    if (certInfo.lpszEncryptionAlgName)
-                        LocalFree(certInfo.lpszEncryptionAlgName);
-                    if (certInfo.lpszIssuerInfo)
-                    {
-                        if (strcmp((LPSTR)certInfo.lpszIssuerInfo, CERT_ISSUER_INFO) != 0)
-                            Ret = FALSE;
-                        LocalFree(certInfo.lpszIssuerInfo);
-                    }
-                    if (certInfo.lpszProtocolName)
-                        LocalFree(certInfo.lpszProtocolName);
-                    if (certInfo.lpszSignatureAlgName)
-                        LocalFree(certInfo.lpszSignatureAlgName);
-                    if (certInfo.lpszSubjectInfo)
-                    {
-                        if (strcmp((LPSTR)certInfo.lpszSubjectInfo, CERT_SUBJECT_INFO) != 0)
-                            Ret = FALSE;
-                        LocalFree(certInfo.lpszSubjectInfo);
-                    }
-                }
-            }
-            InternetCloseHandle(hRequest);
-        }
-        InternetCloseHandle(hConnect);
-    }
-    return Ret;
-}
-#endif
-
-static
-DWORD WINAPI
-ThreadFunc(LPVOID Context)
-{
-    IBindStatusCallback *dl = NULL;
-    WCHAR path[MAX_PATH];
-    PWSTR p, q;
-    HWND Dlg = (HWND) Context;
-    DWORD dwContentLen, dwBytesWritten, dwBytesRead, dwStatus;
-    DWORD dwCurrentBytesRead = 0;
-    DWORD dwStatusLen = sizeof(dwStatus);
-    BOOL bCancelled = FALSE;
-    BOOL bTempfile = FALSE;
-    BOOL bCab = FALSE;
-    HINTERNET hOpen = NULL;
-    HINTERNET hFile = NULL;
-    HANDLE hOut = INVALID_HANDLE_VALUE;
-    unsigned char lpBuffer[4096];
-    const LPWSTR lpszAgent = L"RApps/1.0";
-    URL_COMPONENTS urlComponents;
-    size_t urlLength, filenameLength;
-
-    /* build the path for the download */
-    p = wcsrchr(AppInfo->szUrlDownload, L'/');
-    q = wcsrchr(AppInfo->szUrlDownload, L'?');
-
-    /* do we have a final slash separator? */
-    if (!p)
-        goto end;
-
-    /* prepare the tentative length of the filename, maybe we've to remove part of it later on */
-    filenameLength = wcslen(p) * sizeof(WCHAR);
-
-    /* do we have query arguments in the target URL after the filename? account for them
-      (e.g. https://example.org/myfile.exe?no_adware_plz) */
-    if (q && q > p && (q - p) > 0)
-        filenameLength -= wcslen(q - 1) * sizeof(WCHAR);
-
-    /* is this URL an update package for RAPPS? if so store it in a different place */
-    if (wcscmp(AppInfo->szUrlDownload, APPLICATION_DATABASE_URL) == 0)
-    {
-        bCab = TRUE;
-        if (!GetStorageDirectory(path, _countof(path)))
-            goto end;
-    }
-    else
-    {
-        if (FAILED(StringCbCopyW(path, sizeof(path),  SettingsInfo.szDownloadDir)))
-            goto end;
-    }
-
-    /* is the path valid? can we access it? */
-    if (GetFileAttributesW(path) == INVALID_FILE_ATTRIBUTES)
-    {
-        if (!CreateDirectoryW(path, NULL))
-            goto end;
-    }
-
-    /* append a \ to the provided file system path, and the filename portion from the URL after that */
-    if (FAILED(StringCbCatW(path, sizeof(path), L"\\")))
-        goto end;
-    if (FAILED(StringCbCatNW(path, sizeof(path), p + 1, filenameLength)))
-        goto end;
-
-    /* is the file already there? let's avoid having to download it */
-    if (!bCab && AppInfo->szSHA1[0] != 0 && GetFileAttributesW(path) != INVALID_FILE_ATTRIBUTES)
-    {
-        /* only open it in case of total correctness */
-        if (VerifyInteg(AppInfo->szSHA1, path))
-            goto run;
-    }
-
-    /* create an async download context for it */
-    bTempfile = TRUE;
-    dl = CreateDl(Context, &bCancelled);
-
-    if (dl == NULL)
-        goto end;
-
-    /* FIXME: this should just be using the system-wide proxy settings */
-    switch(SettingsInfo.Proxy)
-    {
-        case 0: /* preconfig */
-            hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
-            break;
-        case 1: /* direct (no proxy) */
-            hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
-            break;
-        case 2: /* use proxy */
-            hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PROXY, SettingsInfo.szProxyServer, SettingsInfo.szNoProxyFor, 0);
-            break;
-        default: /* preconfig */
-            hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
-            break;
-    }
-
-    if (!hOpen)
-        goto end;
-
-    hFile = InternetOpenUrlW(hOpen, AppInfo->szUrlDownload, NULL, 0, INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_KEEP_CONNECTION, 0);
-    if (!hFile)
-        goto end;
-
-    if (!HttpQueryInfoW(hFile, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &dwStatus, &dwStatusLen, NULL))
-        goto end;
-
-    if(dwStatus != HTTP_STATUS_OK)
-    {
-        WCHAR szMsgText[MAX_STR_LEN];
-
-        if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD, szMsgText, _countof(szMsgText)))
-            goto end;
-
-        MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);
-        goto end;
-    }
-
-    dwStatusLen = sizeof(dwStatus);
-
-    memset(&urlComponents, 0, sizeof(urlComponents));
-    urlComponents.dwStructSize = sizeof(urlComponents);
-
-    if(FAILED(StringCbLengthW(AppInfo->szUrlDownload, sizeof(AppInfo->szUrlDownload), &urlLength)))
-        goto end;
-
-    urlLength /= sizeof(WCHAR);
-    urlComponents.dwSchemeLength = urlLength + 1;
-    urlComponents.lpszScheme = malloc(urlComponents.dwSchemeLength * sizeof(WCHAR));
-    urlComponents.dwHostNameLength = urlLength + 1;
-    urlComponents.lpszHostName = malloc(urlComponents.dwHostNameLength * sizeof(WCHAR));
-
-    if(!InternetCrackUrlW(AppInfo->szUrlDownload, urlLength+1, ICU_DECODE | ICU_ESCAPE, &urlComponents))
-        goto end;
-
-    if(urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS)
-        HttpQueryInfo(hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatus, 0);
-
-    if(urlComponents.nScheme == INTERNET_SCHEME_FTP)
-        dwContentLen = FtpGetFileSize(hFile, &dwStatus);
-
-#ifdef USE_CERT_PINNING
-    /* are we using HTTPS to download the RAPPS update package? check if the certificate is original */
-    if ((urlComponents.nScheme == INTERNET_SCHEME_HTTPS) &&
-        (wcscmp(AppInfo->szUrlDownload, APPLICATION_DATABASE_URL) == 0) &&
-        (!CertIsValid(hOpen, urlComponents.lpszHostName)))
-    {
-        WCHAR szMsgText[MAX_STR_LEN];
-
-        if (!LoadStringW(hInst, IDS_CERT_DOES_NOT_MATCH, szMsgText, _countof(szMsgText)))
-            goto end;
-
-        MessageBoxW(Dlg, szMsgText, NULL, MB_OK | MB_ICONERROR);
-        goto end;
-    }
-#endif
-
-    free(urlComponents.lpszScheme);
-    free(urlComponents.lpszHostName);
-
-    hOut = CreateFileW(path, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL);
-
-    if (hOut == INVALID_HANDLE_VALUE)
-        goto end;
-
-    do
-    {
-        if (!InternetReadFile(hFile, lpBuffer, _countof(lpBuffer), &dwBytesRead))
-        {
-            WCHAR szMsgText[MAX_STR_LEN];
-
-            if (!LoadStringW(hInst, IDS_INTERRUPTED_DOWNLOAD, szMsgText, _countof(szMsgText)))
-                goto end;
-
-            MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);
-            goto end;
-        }
-        if (!WriteFile(hOut, &lpBuffer[0], dwBytesRead, &dwBytesWritten, NULL))
-        {
-            WCHAR szMsgText[MAX_STR_LEN];
-
-            if (!LoadStringW(hInst, IDS_UNABLE_TO_WRITE, szMsgText, _countof(szMsgText)))
-                goto end;
-
-            MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);
-            goto end;
-        }
-        dwCurrentBytesRead += dwBytesRead;
-        IBindStatusCallback_OnProgress(dl, dwCurrentBytesRead, dwContentLen, 0, AppInfo->szUrlDownload);
-    }
-    while (dwBytesRead && !bCancelled);
-
-    CloseHandle(hOut);
-    hOut = INVALID_HANDLE_VALUE;
-
-    if (bCancelled)
-        goto end;
-
-    /* if this thing isn't a RAPPS update and it has a SHA-1 checksum
-       verify its integrity by using the native advapi32.A_SHA1 functions */
-    if (!bCab && AppInfo->szSHA1[0] != 0)
-    {
-        WCHAR szMsgText[MAX_STR_LEN];
-
-        /* change a few strings in the download dialog to reflect the verification process */
-        LoadStringW(hInst, IDS_INTEG_CHECK_TITLE, szMsgText, _countof(szMsgText));
-
-        SetWindowText(Dlg, szMsgText);
-        SendMessageW(GetDlgItem(Dlg, IDC_DOWNLOAD_STATUS), WM_SETTEXT, 0, (LPARAM)path);
-
-        /* this may take a while, depending on the file size */
-        if (!VerifyInteg(AppInfo->szSHA1, path))
-        {
-            if (!LoadStringW(hInst, IDS_INTEG_CHECK_FAIL, szMsgText, _countof(szMsgText)))
-                goto end;
-
-            MessageBoxW(Dlg, szMsgText, NULL, MB_OK | MB_ICONERROR);
-            goto end;
-        }
-    }
-
-    ShowWindow(Dlg, SW_HIDE);
-
-run:
-    /* run it */
-    if (!bCab)
-        ShellExecuteW( NULL, L"open", path, NULL, NULL, SW_SHOWNORMAL );
-
-end:
-    if (hOut != INVALID_HANDLE_VALUE)
-        CloseHandle(hOut);
-
-    InternetCloseHandle(hFile);
-    InternetCloseHandle(hOpen);
-
-    if (dl)
-        IBindStatusCallback_Release(dl);
-
-    if (bTempfile)
-    {
-        if (bCancelled || (SettingsInfo.bDelInstaller && !bCab))
-            DeleteFileW(path);
-    }
-
-    EndDialog(Dlg, 0);
-
-    return 0;
-}
-
-
-LRESULT CALLBACK
-DownloadProgressProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
-{
-    static WCHAR szProgressText[MAX_STR_LEN] = {0};
-
-    switch (uMsg)
-    {
-        case WM_SETTEXT:
-        {
-            if (lParam)
-            {
-                StringCbCopyW(szProgressText,
-                              sizeof(szProgressText),
-                              (PCWSTR)lParam);
-            }
-            return TRUE;
-        }
-
-        case WM_ERASEBKGND:
-        case WM_PAINT:
-        {
-            PAINTSTRUCT  ps;
-            HDC hDC = BeginPaint(hWnd, &ps), hdcMem;
-            HBITMAP hbmMem;
-            HANDLE hOld;
-            RECT myRect;
-            UINT win_width, win_height;
-
-            GetClientRect(hWnd, &myRect);
-
-            /* grab the progress bar rect size */
-            win_width  = myRect.right - myRect.left;
-            win_height = myRect.bottom - myRect.top;
-
-            /* create an off-screen DC for double-buffering */
-            hdcMem = CreateCompatibleDC(hDC);
-            hbmMem = CreateCompatibleBitmap(hDC, win_width, win_height);
-
-            hOld = SelectObject(hdcMem, hbmMem);
-
-            /* call the original draw code and redirect it to our memory buffer */
-            DefSubclassProc(hWnd, uMsg, (WPARAM)hdcMem, lParam);
-
-            /* draw our nifty progress text over it */
-            SelectFont(hdcMem, GetStockFont(DEFAULT_GUI_FONT));
-            DrawShadowText(hdcMem, szProgressText, wcslen(szProgressText),
-                           &myRect,
-                           DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE,
-                           GetSysColor(COLOR_CAPTIONTEXT),
-                           GetSysColor(COLOR_3DSHADOW),
-                           1, 1);
-
-            /* transfer the off-screen DC to the screen */
-            BitBlt(hDC, 0, 0, win_width, win_height, hdcMem, 0, 0, SRCCOPY);
-
-            /* free the off-screen DC */
-            SelectObject(hdcMem, hOld);
-            DeleteObject(hbmMem);
-            DeleteDC(hdcMem);
-
-            EndPaint(hWnd, &ps);
-            return 0;
-        }
-
-        /* Raymond Chen says that we should safely unsubclass all the things!
-          (http://blogs.msdn.com/b/oldnewthing/archive/2003/11/11/55653.aspx) */
-        case WM_NCDESTROY:
-        {
-            ZeroMemory(szProgressText, sizeof(szProgressText));
-            RemoveWindowSubclass(hWnd, DownloadProgressProc, uIdSubclass);
-        }
-        /* Fall-through */
-        default:
-            return DefSubclassProc(hWnd, uMsg, wParam, lParam);
-    }
-}
-
-static
-INT_PTR CALLBACK
-DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-    HANDLE Thread;
-    DWORD ThreadId;
-    HWND Item;
-
-    switch (uMsg)
-    {
-        case WM_INITDIALOG:
-        {
-            HICON hIconSm = NULL, hIconBg = NULL;
-
-            hIconBg = (HICON)GetClassLongPtr(hMainWnd, GCLP_HICON);
-            hIconSm = (HICON)GetClassLongPtr(hMainWnd, GCLP_HICONSM);
-
-            if (hIconBg && hIconSm)
-            {
-                SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM) hIconBg);
-                SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSm);
-            }
-
-            SetWindowLongPtrW(Dlg, GWLP_USERDATA, 0);
-            Item = GetDlgItem(Dlg, IDC_DOWNLOAD_PROGRESS);
-            if (Item)
-            {
-                /* initialize the default values for our nifty progress bar
-                   and subclass it so that it learns to print a status text */
-                SendMessageW(Item, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
-                SendMessageW(Item, PBM_SETPOS, 0, 0);
-
-                SetWindowSubclass(Item, DownloadProgressProc, 0, 0);
-            }
-
-            /* add a neat placeholder until the download URL is retrieved */
-            Item = GetDlgItem(Dlg, IDC_DOWNLOAD_STATUS);
-            SendMessageW(Item, WM_SETTEXT, 0, (LPARAM)L"\x2022 \x2022 \x2022");
-
-            Thread = CreateThread(NULL, 0, ThreadFunc, Dlg, 0, &ThreadId);
-            if (!Thread)
-                return FALSE;
-
-            CloseHandle(Thread);
-            return TRUE;
-        }
-        case WM_COMMAND:
-            if (wParam == IDCANCEL)
-            {
-                SetWindowLongPtrW(Dlg, GWLP_USERDATA, 1);
-                PostMessageW(Dlg, WM_CLOSE, 0, 0);
-            }
-            return FALSE;
-
-        case WM_CLOSE:
-            EndDialog(Dlg, 0);
-            return TRUE;
-
-        default:
-            return FALSE;
-    }
-}
-
-BOOL
-DownloadApplication(INT Index)
-{
-    if (!IS_AVAILABLE_ENUM(SelectedEnumType))
-        return FALSE;
-
-    AppInfo = (PAPPLICATION_INFO) ListViewGetlParam(Index);
-    if (!AppInfo) return FALSE;
-
-    WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_INSTALL, AppInfo->szName);
-
-    DialogBoxW(hInst,
-               MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG),
-               hMainWnd,
-               DownloadDlgProc);
-
-    return TRUE;
-}
-
-VOID
-DownloadApplicationsDB(LPWSTR lpUrl)
-{
-    APPLICATION_INFO IntInfo;
-
-    ZeroMemory(&IntInfo, sizeof(IntInfo));
-    if (FAILED(StringCbCopyW(IntInfo.szUrlDownload,
-                             sizeof(IntInfo.szUrlDownload),
-                             lpUrl)))
-    {
-        return;
-    }
-
-    AppInfo = &IntInfo;
-
-    DialogBoxW(hInst,
-               MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG),
-               hMainWnd,
-               DownloadDlgProc);
-}
-
diff --git a/base/applications/rapps/misc.c b/base/applications/rapps/misc.c
deleted file mode 100644 (file)
index aade3eb..0000000
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/misc.c
- * PURPOSE:         Misc functions
- * PROGRAMMERS:     Dmitry Chapyshev           (dmitry@reactos.org)
- *                  Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
- */
-
-#include "rapps.h"
-#include <sha1.h>
-
-/* SESSION Operation */
-#define EXTRACT_FILLFILELIST  0x00000001
-#define EXTRACT_EXTRACTFILES  0x00000002
-
-static HANDLE hLog = NULL;
-WCHAR szCachedINISectionLocale[MAX_PATH] = L"Section.";
-WCHAR szCachedINISectionLocaleNeutral[MAX_PATH] = {0};
-BYTE bCachedSectionStatus = FALSE;
-
-typedef struct
-{
-    int erfOper;
-    int erfType;
-    BOOL fError;
-} ERF, *PERF;
-
-struct FILELIST
-{
-    LPSTR FileName;
-    struct FILELIST *next;
-    BOOL DoExtract;
-};
-
-typedef struct
-{
-    INT FileSize;
-    ERF Error;
-    struct FILELIST *FileList;
-    INT FileCount;
-    INT Operation;
-    CHAR Destination[MAX_PATH];
-    CHAR CurrentFile[MAX_PATH];
-    CHAR Reserved[MAX_PATH];
-    struct FILELIST *FilterList;
-} SESSION;
-
-HRESULT (WINAPI *pfnExtract)(SESSION *dest, LPCSTR szCabName);
-
-
-INT
-GetSystemColorDepth(VOID)
-{
-    DEVMODE pDevMode;
-    INT ColorDepth;
-
-    pDevMode.dmSize = sizeof(pDevMode);
-    pDevMode.dmDriverExtra = 0;
-
-    if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &pDevMode))
-    {
-        /* TODO: Error message */
-        return ILC_COLOR;
-    }
-
-    switch (pDevMode.dmBitsPerPel)
-    {
-        case 32: ColorDepth = ILC_COLOR32; break;
-        case 24: ColorDepth = ILC_COLOR24; break;
-        case 16: ColorDepth = ILC_COLOR16; break;
-        case  8: ColorDepth = ILC_COLOR8;  break;
-        case  4: ColorDepth = ILC_COLOR4;  break;
-        default: ColorDepth = ILC_COLOR;   break;
-    }
-
-    return ColorDepth;
-}
-
-int
-GetWindowWidth(HWND hwnd)
-{
-    RECT Rect;
-
-    GetWindowRect(hwnd, &Rect);
-    return (Rect.right - Rect.left);
-}
-
-int
-GetWindowHeight(HWND hwnd)
-{
-    RECT Rect;
-
-    GetWindowRect(hwnd, &Rect);
-    return (Rect.bottom - Rect.top);
-}
-
-int
-GetClientWindowWidth(HWND hwnd)
-{
-    RECT Rect;
-
-    GetClientRect(hwnd, &Rect);
-    return (Rect.right - Rect.left);
-}
-
-int
-GetClientWindowHeight(HWND hwnd)
-{
-    RECT Rect;
-
-    GetClientRect(hwnd, &Rect);
-    return (Rect.bottom - Rect.top);
-}
-
-VOID
-CopyTextToClipboard(LPCWSTR lpszText)
-{
-    HRESULT hr;
-
-    if (OpenClipboard(NULL))
-    {
-        HGLOBAL ClipBuffer;
-        WCHAR *Buffer;
-        DWORD cchBuffer;
-
-        EmptyClipboard();
-        cchBuffer = wcslen(lpszText) + 1;
-        ClipBuffer = GlobalAlloc(GMEM_DDESHARE, cchBuffer * sizeof(WCHAR));
-        Buffer = GlobalLock(ClipBuffer);
-        hr = StringCchCopyW(Buffer, cchBuffer, lpszText);
-        GlobalUnlock(ClipBuffer);
-
-        if (SUCCEEDED(hr))
-            SetClipboardData(CF_UNICODETEXT, ClipBuffer);
-
-        CloseClipboard();
-    }
-}
-
-VOID
-SetWelcomeText(VOID)
-{
-    WCHAR szText[MAX_STR_LEN*3];
-
-    LoadStringW(hInst, IDS_WELCOME_TITLE, szText, _countof(szText));
-    NewRichEditText(szText, CFE_BOLD);
-
-    LoadStringW(hInst, IDS_WELCOME_TEXT, szText, _countof(szText));
-    InsertRichEditText(szText, 0);
-
-    LoadStringW(hInst, IDS_WELCOME_URL, szText, _countof(szText));
-    InsertRichEditText(szText, CFM_LINK);
-}
-
-VOID
-ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem)
-{
-    HMENU hMenu = NULL;
-    HMENU hPopupMenu;
-    MENUITEMINFO mii;
-    POINT pt;
-
-    if (MenuID)
-    {
-        hMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(MenuID));
-        hPopupMenu = GetSubMenu(hMenu, 0);
-    }
-    else
-        hPopupMenu = GetMenu(hwnd);
-
-    ZeroMemory(&mii, sizeof(mii));
-    mii.cbSize = sizeof(mii);
-    mii.fMask = MIIM_STATE;
-    GetMenuItemInfo(hPopupMenu, DefaultItem, FALSE, &mii);
-
-    if (!(mii.fState & MFS_GRAYED))
-        SetMenuDefaultItem(hPopupMenu, DefaultItem, FALSE);
-
-    GetCursorPos(&pt);
-
-    SetForegroundWindow(hwnd);
-    TrackPopupMenu(hPopupMenu, 0, pt.x, pt.y, 0, hMainWnd, NULL);
-
-    if (hMenu)
-        DestroyMenu(hMenu);
-}
-
-BOOL
-StartProcess(LPWSTR lpPath, BOOL Wait)
-{
-    PROCESS_INFORMATION pi;
-    STARTUPINFOW si;
-    DWORD dwRet;
-    MSG msg;
-
-    ZeroMemory(&si, sizeof(si));
-    si.cb = sizeof(si);
-    si.dwFlags = STARTF_USESHOWWINDOW;
-    si.wShowWindow = SW_SHOW;
-
-    if (!CreateProcessW(NULL, lpPath, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
-    {
-        return FALSE;
-    }
-
-    CloseHandle(pi.hThread);
-    if (Wait) EnableWindow(hMainWnd, FALSE);
-
-    while (Wait)
-    {
-        dwRet = MsgWaitForMultipleObjects(1, &pi.hProcess, FALSE, INFINITE, QS_ALLEVENTS);
-        if (dwRet == WAIT_OBJECT_0 + 1)
-        {
-            while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
-            {
-                TranslateMessage(&msg);
-                DispatchMessage(&msg);
-            }
-        }
-        else
-        {
-            if (dwRet == WAIT_OBJECT_0 || dwRet == WAIT_FAILED)
-                break;
-        }
-    }
-
-    CloseHandle(pi.hProcess);
-
-    if (Wait)
-    {
-        EnableWindow(hMainWnd, TRUE);
-        SetForegroundWindow(hMainWnd);
-        SetFocus(hMainWnd);
-    }
-
-    return TRUE;
-}
-
-BOOL
-GetStorageDirectory(PWCHAR lpDirectory, DWORD cch)
-{
-    if (cch < MAX_PATH)
-        return FALSE;
-
-    if (!SHGetSpecialFolderPathW(NULL, lpDirectory, CSIDL_LOCAL_APPDATA, TRUE))
-        return FALSE;
-
-    if (FAILED(StringCchCatW(lpDirectory, cch, L"\\rapps")))
-        return FALSE;
-
-    if (!CreateDirectoryW(lpDirectory, NULL) &&
-        GetLastError() != ERROR_ALREADY_EXISTS)
-    {
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
-BOOL
-ExtractFilesFromCab(LPWSTR lpCabName, LPWSTR lpOutputPath)
-{
-    HINSTANCE hCabinetDll;
-    CHAR szCabName[MAX_PATH];
-    SESSION Dest;
-    HRESULT Result;
-
-    hCabinetDll = LoadLibraryW(L"cabinet.dll");
-    if (hCabinetDll)
-    {
-        pfnExtract = (void *) GetProcAddress(hCabinetDll, "Extract");
-        if (pfnExtract)
-        {
-            ZeroMemory(&Dest, sizeof(Dest));
-
-            WideCharToMultiByte(CP_ACP, 0, lpOutputPath, -1, Dest.Destination, MAX_PATH, NULL, NULL);
-            WideCharToMultiByte(CP_ACP, 0, lpCabName, -1, szCabName, MAX_PATH, NULL, NULL);
-            Dest.Operation = EXTRACT_FILLFILELIST;
-
-            Result = pfnExtract(&Dest, szCabName);
-            if (Result == S_OK)
-            {
-                Dest.Operation = EXTRACT_EXTRACTFILES;
-                Result = pfnExtract(&Dest, szCabName);
-                if (Result == S_OK)
-                {
-                    FreeLibrary(hCabinetDll);
-                    return TRUE;
-                }
-            }
-        }
-        FreeLibrary(hCabinetDll);
-    }
-
-    return FALSE;
-}
-
-VOID
-InitLogs(VOID)
-{
-    WCHAR szBuf[MAX_PATH] = L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\ReactOS Application Manager";
-    WCHAR szPath[MAX_PATH];
-    DWORD dwCategoryNum = 1;
-    DWORD dwDisp, dwData;
-    HKEY hKey;
-
-    if (!SettingsInfo.bLogEnabled) return;
-
-    if (RegCreateKeyExW(HKEY_LOCAL_MACHINE,
-                        szBuf, 0, NULL,
-                        REG_OPTION_NON_VOLATILE,
-                        KEY_WRITE, NULL, &hKey, &dwDisp) != ERROR_SUCCESS)
-    {
-        return;
-    }
-
-    if (!GetModuleFileNameW(NULL, szPath, _countof(szPath)))
-        return;
-
-    if (RegSetValueExW(hKey,
-                       L"EventMessageFile",
-                       0,
-                       REG_EXPAND_SZ,
-                       (LPBYTE)szPath,
-                       (DWORD)(wcslen(szPath) + 1) * sizeof(WCHAR)) != ERROR_SUCCESS)
-    {
-        RegCloseKey(hKey);
-        return;
-    }
-
-    dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE |
-             EVENTLOG_INFORMATION_TYPE;
-
-    if (RegSetValueExW(hKey,
-                       L"TypesSupported",
-                       0,
-                       REG_DWORD,
-                       (LPBYTE)&dwData,
-                       sizeof(DWORD)) != ERROR_SUCCESS)
-    {
-        RegCloseKey(hKey);
-        return;
-    }
-
-    if (RegSetValueExW(hKey,
-                       L"CategoryMessageFile",
-                       0,
-                       REG_EXPAND_SZ,
-                       (LPBYTE)szPath,
-                       (DWORD)(wcslen(szPath) + 1) * sizeof(WCHAR)) != ERROR_SUCCESS)
-    {
-        RegCloseKey(hKey);
-        return;
-    }
-
-    if (RegSetValueExW(hKey,
-                       L"CategoryCount",
-                       0,
-                       REG_DWORD,
-                       (LPBYTE)&dwCategoryNum,
-                       sizeof(DWORD)) != ERROR_SUCCESS)
-    {
-        RegCloseKey(hKey);
-        return;
-    }
-
-    RegCloseKey(hKey);
-
-    hLog = RegisterEventSourceW(NULL, L"ReactOS Application Manager");
-}
-
-
-VOID
-FreeLogs(VOID)
-{
-    if (hLog) DeregisterEventSource(hLog);
-}
-
-
-BOOL
-WriteLogMessage(WORD wType, DWORD dwEventID, LPWSTR lpMsg)
-{
-    if (!SettingsInfo.bLogEnabled) return TRUE;
-
-    if (!ReportEventW(hLog,
-                      wType,
-                      0,
-                      dwEventID,
-                      NULL,
-                      1,
-                      0,
-                      (LPCWSTR*)&lpMsg,
-                      NULL))
-    {
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
-
-LPWSTR GetINIFullPath(LPCWSTR lpFileName)
-{
-           WCHAR szDir[MAX_PATH];
-    static WCHAR szBuffer[MAX_PATH];
-
-    GetStorageDirectory(szDir, _countof(szDir));
-    StringCbPrintfW(szBuffer, sizeof(szBuffer), L"%ls\\rapps\\%ls", szDir, lpFileName);
-
-    return szBuffer;
-}
-
-
-UINT ParserGetString(LPCWSTR lpKeyName, LPWSTR lpReturnedString, UINT nSize, LPCWSTR lpFileName)
-{
-    PWSTR lpFullFileName = GetINIFullPath(lpFileName);
-    DWORD dwResult;
-
-    /* we don't have cached section strings for the current system language, create them */
-    if(bCachedSectionStatus == FALSE)
-    {
-        WCHAR szLocale[4 + 1];
-        DWORD len;
-
-        /* find out what is the current system lang code (e.g. "0a") and append it to SectionLocale */
-        GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE,
-                       szLocale, _countof(szLocale));
-
-        StringCbCatW(szCachedINISectionLocale, sizeof(szCachedINISectionLocale), szLocale);
-
-        /* copy the locale-dependent string into the buffer of the future neutral one */
-        StringCbCopyW(szCachedINISectionLocaleNeutral,
-                      sizeof(szCachedINISectionLocaleNeutral),
-                      szCachedINISectionLocale);
-
-        /* turn "Section.0c0a" into "Section.0a", keeping just the neutral lang part */
-        len = wcslen(szCachedINISectionLocale);
-
-        memmove((szCachedINISectionLocaleNeutral + len) - 4,
-                (szCachedINISectionLocaleNeutral + len) - 2,
-                (2 * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
-
-        /* finally, mark us as cache-friendly for the next time */
-        bCachedSectionStatus = TRUE;
-    }
-
-    /* 1st - find localized strings (e.g. "Section.0c0a") */
-    dwResult = GetPrivateProfileStringW(szCachedINISectionLocale,
-                                        lpKeyName,
-                                        NULL,
-                                        lpReturnedString,
-                                        nSize,
-                                        lpFullFileName);
-
-    if (dwResult != 0)
-        return TRUE;
-
-    /* 2nd - if they weren't present check for neutral sub-langs/ generic translations (e.g. "Section.0a") */
-    dwResult = GetPrivateProfileStringW(szCachedINISectionLocaleNeutral,
-                                        lpKeyName,
-                                        NULL,
-                                        lpReturnedString,
-                                        nSize,
-                                        lpFullFileName);
-
-    if (dwResult != 0)
-        return TRUE;
-
-    /* 3rd - if they weren't present fallback to standard english strings (just "Section") */
-    dwResult = GetPrivateProfileStringW(L"Section",
-                                        lpKeyName,
-                                        NULL,
-                                        lpReturnedString,
-                                        nSize,
-                                        lpFullFileName);
-
-    return (dwResult != 0 ? TRUE : FALSE);
-}
-
-UINT ParserGetInt(LPCWSTR lpKeyName, LPCWSTR lpFileName)
-{
-    WCHAR Buffer[30];
-    UNICODE_STRING BufferW;
-    ULONG Result;
-
-    /* grab the text version of our entry */
-    if (!ParserGetString(lpKeyName, Buffer, _countof(Buffer), lpFileName))
-        return FALSE;
-
-    if (!Buffer[0])
-        return FALSE;
-
-    /* convert it to an actual integer */
-    RtlInitUnicodeString(&BufferW, Buffer);
-    RtlUnicodeStringToInteger(&BufferW, 0, &Result);
-
-    return Result;
-}
-
-BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName)
-{
-    BOOL ret = FALSE;
-    const unsigned char *file_map;
-    HANDLE file, map;
-
-    ULONG sha[5];
-    WCHAR buf[40 + 1];
-    SHA_CTX ctx;
-
-    LARGE_INTEGER size;
-    UINT i;
-
-    /* first off, does it exist at all? */
-    file = CreateFileW(lpFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
-
-    if (file == INVALID_HANDLE_VALUE)
-        return FALSE;
-
-    /* let's grab the actual file size to organize the mmap'ing rounds */
-    GetFileSizeEx(file, &size);
-
-    /* retrieve a handle to map the file contents to memory */
-    map = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
-    if (!map)
-        goto cleanup;
-
-    /* initialize the SHA-1 context */
-    A_SHAInit(&ctx);
-
-    /* map that thing in address space */
-    file_map = MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0);
-    if (!file_map)
-        goto cleanup;
-
-    /* feed the data to the cookie monster */
-    A_SHAUpdate(&ctx, file_map, size.LowPart);
-
-    /* cool, we don't need this anymore */
-    UnmapViewOfFile(file_map);
-
-    /* we're done, compute the final hash */
-    A_SHAFinal(&ctx, sha);
-
-    for (i = 0; i < sizeof(sha); i++)
-        swprintf(buf + 2 * i, L"%02x", ((unsigned char *)sha)[i]);
-
-    /* does the resulting SHA1 match with the provided one? */
-    if (!_wcsicmp(buf, lpSHA1Hash))
-        ret = TRUE;
-
-cleanup:
-    CloseHandle(map);
-    CloseHandle(file);
-
-    return ret;
-}
diff --git a/base/applications/rapps/richedit.c b/base/applications/rapps/richedit.c
deleted file mode 100644 (file)
index 4849c6c..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/richedit.c
- * PURPOSE:         RichEdit functions
- * PROGRAMMERS:     Dmitry Chapyshev (dmitry@reactos.org)
- */
-
-#include "rapps.h"
-
-#include <shlwapi.h>
-
-HWND hRichEdit;
-PWSTR pLink = NULL;
-
-VOID
-RichEditOnLink(HWND hwnd, ENLINK *Link)
-{
-    switch (Link->msg)
-    {
-        case WM_LBUTTONUP:
-        case WM_RBUTTONUP:
-        {
-            if (pLink) HeapFree(GetProcessHeap(), 0, pLink);
-
-            pLink = HeapAlloc(GetProcessHeap(),
-                              0,
-                              (max(Link->chrg.cpMin, Link->chrg.cpMax) -
-                               min(Link->chrg.cpMin, Link->chrg.cpMax) + 1) * sizeof(WCHAR));
-            if (!pLink)
-            {
-                /* TODO: Error message */
-                return;
-            }
-
-            SendMessageW(hRichEdit, EM_SETSEL, Link->chrg.cpMin, Link->chrg.cpMax);
-            SendMessageW(hRichEdit, EM_GETSELTEXT, 0, (LPARAM)pLink);
-
-            ShowPopupMenu(hwnd, IDR_LINKMENU, -1);
-        }
-        break;
-    }
-}
-
-static VOID
-SetRangeFormatting(LONG Start, LONG End, DWORD dwEffects)
-{
-    CHARFORMAT2 CharFormat;
-
-    SendMessageW(hRichEdit, EM_SETSEL, Start, End);
-
-    ZeroMemory(&CharFormat, sizeof(CharFormat));
-
-    CharFormat.cbSize = sizeof(CharFormat);
-    CharFormat.dwMask = dwEffects;
-    CharFormat.dwEffects = dwEffects;
-
-    SendMessageW(hRichEdit, EM_SETCHARFORMAT, SCF_WORD | SCF_SELECTION, (LPARAM)&CharFormat);
-
-    SendMessageW(hRichEdit, EM_SETSEL, End, End + 1);
-}
-
-static LONG
-GetRichEditTextLen(VOID)
-{
-    GETTEXTLENGTHEX TxtLenStruct;
-
-    TxtLenStruct.flags = GTL_NUMCHARS;
-    TxtLenStruct.codepage = 1200;
-
-    return (LONG) SendMessageW(hRichEdit, EM_GETTEXTLENGTHEX, (WPARAM)&TxtLenStruct, 0);
-}
-
-/*
- * Insert text (without cleaning old text)
- * Supported effects:
- *   - CFM_BOLD
- *   - CFM_ITALIC
- *   - CFM_UNDERLINE
- *   - CFM_LINK
- */
-VOID
-InsertRichEditText(LPCWSTR lpszText, DWORD dwEffects)
-{
-    SETTEXTEX SetText;
-    LONG Len = GetRichEditTextLen();
-
-    /* Insert new text */
-    SetText.flags = ST_SELECTION;
-    SetText.codepage = 1200;
-
-    SendMessageW(hRichEdit, EM_SETTEXTEX, (WPARAM)&SetText, (LPARAM)lpszText);
-
-    SetRangeFormatting(Len, Len + wcslen(lpszText),
-                       (dwEffects == CFM_LINK) ? (PathIsURLW(lpszText) ? dwEffects : 0) : dwEffects);
-}
-
-/*
- * Clear old text and add new
- */
-VOID
-NewRichEditText(LPCWSTR lpszText, DWORD dwEffects)
-{
-    SetWindowTextW(hRichEdit, L"");
-    InsertRichEditText(lpszText, dwEffects);
-}
-
-BOOL
-CreateRichEdit(HWND hwnd)
-{
-    LoadLibraryW(L"riched20.dll");
-
-    hRichEdit = CreateWindowExW(0,
-                                L"RichEdit20W",
-                                NULL,
-                                WS_CHILD | WS_VISIBLE | ES_MULTILINE |
-                                ES_LEFT | ES_READONLY,
-                                205, 28, 465, 100,
-                                hwnd,
-                                NULL,
-                                hInst,
-                                NULL);
-
-    if (!hRichEdit)
-    {
-        /* TODO: Show error message */
-        return FALSE;
-    }
-
-    SendMessageW(hRichEdit, EM_SETBKGNDCOLOR, 0, GetSysColor(COLOR_BTNFACE));
-    SendMessageW(hRichEdit, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
-    SendMessageW(hRichEdit, EM_SETEVENTMASK, 0, ENM_LINK | ENM_MOUSEEVENTS);
-    SendMessageW(hRichEdit, EM_SHOWSCROLLBAR, SB_VERT, TRUE);
-
-    return TRUE;
-}
diff --git a/base/applications/rapps/settingsdlg.c b/base/applications/rapps/settingsdlg.c
deleted file mode 100644 (file)
index ca4b5ea..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/settingsdlg.c
- * PURPOSE:         Settings Dialog
- * PROGRAMMERS:     Dmitry Chapyshev (dmitry@reactos.org)
- */
-
-#include "rapps.h"
-
-SETTINGS_INFO NewSettingsInfo;
-
-#define IS_CHECKED(a, b) \
-    a = (SendDlgItemMessage(hDlg, b, BM_GETCHECK, 0, 0) == BST_CHECKED) ? TRUE : FALSE
-
-BOOL
-ChooseFolder(HWND hwnd)
-{
-    BOOL bRet = FALSE;
-    BROWSEINFO bi;
-    WCHAR szPath[MAX_PATH], szBuf[MAX_STR_LEN];
-
-    LoadStringW(hInst, IDS_CHOOSE_FOLDER_TEXT, szBuf, _countof(szBuf));
-
-    ZeroMemory(&bi, sizeof(bi));
-    bi.hwndOwner = hwnd;
-    bi.pidlRoot  = NULL;
-    bi.lpszTitle = szBuf;
-    bi.ulFlags   = BIF_USENEWUI | BIF_DONTGOBELOWDOMAIN | BIF_RETURNONLYFSDIRS | /* BIF_BROWSEFILEJUNCTIONS | */ BIF_VALIDATE;
-
-    if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
-    {
-        LPITEMIDLIST lpItemList = SHBrowseForFolder(&bi);
-        if (lpItemList && SHGetPathFromIDList(lpItemList, szPath))
-        {
-            if (szPath[0] != 0)
-            {
-                SetDlgItemTextW(hwnd, IDC_DOWNLOAD_DIR_EDIT, szPath);
-                bRet = TRUE;
-            }
-        }
-
-        CoTaskMemFree(lpItemList);
-        CoUninitialize();
-    }
-
-    return bRet;
-}
-
-static VOID
-InitSettingsControls(HWND hDlg, PSETTINGS_INFO Info)
-{
-    SendDlgItemMessage(hDlg, IDC_SAVE_WINDOW_POS, BM_SETCHECK, Info->bSaveWndPos, 0);
-    SendDlgItemMessage(hDlg, IDC_UPDATE_AVLIST, BM_SETCHECK, Info->bUpdateAtStart, 0);
-    SendDlgItemMessage(hDlg, IDC_LOG_ENABLED, BM_SETCHECK, Info->bLogEnabled, 0);
-    SendDlgItemMessage(hDlg, IDC_DEL_AFTER_INSTALL, BM_SETCHECK, Info->bDelInstaller, 0);
-
-    SetWindowTextW(GetDlgItem(hDlg, IDC_DOWNLOAD_DIR_EDIT),
-                   Info->szDownloadDir);
-
-    CheckRadioButton(hDlg, IDC_PROXY_DEFAULT, IDC_USE_PROXY, IDC_PROXY_DEFAULT+Info->Proxy);
-
-    if(IDC_PROXY_DEFAULT + Info->Proxy == IDC_USE_PROXY)
-    {
-        EnableWindow(GetDlgItem(hDlg, IDC_PROXY_SERVER), TRUE);
-        EnableWindow(GetDlgItem(hDlg, IDC_NO_PROXY_FOR), TRUE);
-    }
-
-    SetWindowTextW(GetDlgItem(hDlg, IDC_PROXY_SERVER), Info->szProxyServer);
-    SetWindowTextW(GetDlgItem(hDlg, IDC_NO_PROXY_FOR), Info->szNoProxyFor);
-}
-
-static
-INT_PTR CALLBACK
-SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
-{
-    switch (Msg)
-    {
-        case WM_INITDIALOG:
-        {
-            NewSettingsInfo = SettingsInfo;
-            InitSettingsControls(hDlg, &SettingsInfo);
-        }
-        break;
-
-        case WM_COMMAND:
-        {
-            switch (LOWORD(wParam))
-            {
-                case IDC_CHOOSE:
-                    ChooseFolder(hDlg);
-                    break;
-
-                case IDC_SAVE_WINDOW_POS:
-                    IS_CHECKED(NewSettingsInfo.bSaveWndPos, IDC_SAVE_WINDOW_POS);
-                    break;
-
-                case IDC_UPDATE_AVLIST:
-                    IS_CHECKED(NewSettingsInfo.bUpdateAtStart, IDC_UPDATE_AVLIST);
-                    break;
-
-                case IDC_LOG_ENABLED:
-                    IS_CHECKED(NewSettingsInfo.bLogEnabled, IDC_LOG_ENABLED);
-                    break;
-
-                case IDC_DEL_AFTER_INSTALL:
-                    IS_CHECKED(NewSettingsInfo.bDelInstaller, IDC_DEL_AFTER_INSTALL);
-                    break;
-
-                case IDC_PROXY_DEFAULT:
-                    NewSettingsInfo.Proxy = 0;
-                    EnableWindow(GetDlgItem(hDlg, IDC_PROXY_SERVER), FALSE);
-                    EnableWindow(GetDlgItem(hDlg, IDC_NO_PROXY_FOR), FALSE);
-                    break;
-
-                case IDC_NO_PROXY:
-                    NewSettingsInfo.Proxy = 1;
-                    EnableWindow(GetDlgItem(hDlg, IDC_PROXY_SERVER), FALSE);
-                    EnableWindow(GetDlgItem(hDlg, IDC_NO_PROXY_FOR), FALSE);
-                    break;
-
-                case IDC_USE_PROXY:
-                    NewSettingsInfo.Proxy = 2;
-                    EnableWindow(GetDlgItem(hDlg, IDC_PROXY_SERVER), TRUE);
-                    EnableWindow(GetDlgItem(hDlg, IDC_NO_PROXY_FOR), TRUE);
-                    break;
-
-                case IDC_DEFAULT_SETTINGS:
-                    FillDefaultSettings(&NewSettingsInfo);
-                    InitSettingsControls(hDlg, &NewSettingsInfo);
-                    break;
-
-                case IDOK:
-                {
-                    WCHAR szDir[MAX_PATH];
-                    WCHAR szProxy[MAX_PATH];
-                    WCHAR szNoProxy[MAX_PATH];
-                    DWORD dwAttr;
-
-                    GetWindowTextW(GetDlgItem(hDlg, IDC_DOWNLOAD_DIR_EDIT),
-                                   szDir, MAX_PATH);
-
-                    GetWindowTextW(GetDlgItem(hDlg, IDC_PROXY_SERVER),
-                                   szProxy, MAX_PATH);
-                    StringCbCopyW(NewSettingsInfo.szProxyServer, sizeof(NewSettingsInfo.szProxyServer), szProxy);
-
-                    GetWindowTextW(GetDlgItem(hDlg, IDC_NO_PROXY_FOR),
-                                   szNoProxy, MAX_PATH);
-                    StringCbCopyW(NewSettingsInfo.szNoProxyFor, sizeof(NewSettingsInfo.szNoProxyFor), szNoProxy);
-
-                    dwAttr = GetFileAttributesW(szDir);
-                    if (dwAttr != INVALID_FILE_ATTRIBUTES &&
-                        (dwAttr & FILE_ATTRIBUTE_DIRECTORY))
-                    {
-                        StringCbCopyW(NewSettingsInfo.szDownloadDir,
-                                      sizeof(NewSettingsInfo.szDownloadDir),
-                                      szDir);
-                    }
-                    else
-                    {
-                        WCHAR szMsgText[MAX_STR_LEN];
-
-                        LoadStringW(hInst,
-                                    IDS_CHOOSE_FOLDER_ERROR,
-                                    szMsgText, _countof(szMsgText));
-
-                        if (MessageBoxW(hDlg, szMsgText, NULL, MB_YESNO) == IDYES)
-                        {
-                            if (CreateDirectoryW(szDir, NULL))
-                            {
-                                EndDialog(hDlg, LOWORD(wParam));
-                            }
-                        }
-                        else
-                        {
-                            SetFocus(GetDlgItem(hDlg, IDC_DOWNLOAD_DIR_EDIT));
-                            break;
-                        }
-                    }
-
-                    SettingsInfo = NewSettingsInfo;
-                    SaveSettings(GetParent(hDlg));
-                    EndDialog(hDlg, LOWORD(wParam));
-                }
-                break;
-
-                case IDCANCEL:
-                    EndDialog(hDlg, LOWORD(wParam));
-                    break;
-            }
-        }
-        break;
-    }
-
-    return FALSE;
-}
-
-VOID
-CreateSettingsDlg(HWND hwnd)
-{
-    DialogBoxW(hInst,
-               MAKEINTRESOURCEW(IDD_SETTINGS_DIALOG),
-               hwnd,
-               SettingsDlgProc);
-}
diff --git a/base/applications/rapps/splitter.c b/base/applications/rapps/splitter.c
deleted file mode 100644 (file)
index 8792868..0000000
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/splitter.c
- * PURPOSE:         SplitterBar functions
- * PROGRAMMERS:     Dmitry Chapyshev (dmitry@reactos.org)
- */
-
-#include "rapps.h"
-
-HWND hVSplitter = NULL;
-HWND hHSplitter = NULL;
-
-static int HSplitterPos = 0;
-
-int
-GetHSplitterPos(VOID)
-{
-    return HSplitterPos;
-}
-
-VOID
-SetHSplitterPos(int Pos)
-{
-    HSplitterPos = Pos;
-}
-
-/* Callback for horizontal splitter bar */
-LRESULT CALLBACK
-HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
-{
-    switch (Msg)
-    {
-        case WM_CREATE:
-        {
-            SetHSplitterPos(GetWindowHeight(hListView));
-        }
-        break;
-
-        case WM_LBUTTONDOWN:
-        {
-            SetCapture(hwnd);
-        }
-        break;
-
-        case WM_LBUTTONUP:
-        case WM_RBUTTONDOWN:
-            if (GetCapture() == hwnd)
-            {
-                ReleaseCapture();
-            }
-        break;
-
-        case WM_MOUSEMOVE:
-            if (GetCapture() == hwnd)
-            {
-                int Width = GetClientWindowWidth(hMainWnd) - GetWindowWidth(hTreeView) - SPLIT_WIDTH;
-                int NewPos;
-                HDWP hdwp;
-                POINT Point;
-
-                GetCursorPos(&Point);
-                ScreenToClient(hMainWnd, &Point);
-
-                NewPos = Point.y;
-
-                if ((GetClientWindowHeight(hMainWnd) - GetWindowHeight(hStatusBar) - SPLIT_WIDTH) < NewPos)
-                    break;
-
-                if ((GetWindowHeight(hToolBar) + SPLIT_WIDTH) > NewPos)
-                    break;
-
-                SetHSplitterPos(NewPos);
-
-                hdwp = BeginDeferWindowPos(3);
-
-                /* Size HSplitBar */
-                if (hdwp)
-                    hdwp = DeferWindowPos(hdwp,
-                                          hHSplitter,
-                                          0,
-                                          GetWindowWidth(hTreeView) + SPLIT_WIDTH,
-                                          Point.y,
-                                          Width,
-                                          SPLIT_WIDTH,
-                                          SWP_NOZORDER|SWP_NOACTIVATE);
-
-                /* Size ListView */
-                if (hdwp)
-                    hdwp = DeferWindowPos(hdwp,
-                                          hListView,
-                                          0,
-                                          GetWindowWidth(hTreeView) + SPLIT_WIDTH,
-                                          GetWindowHeight(hToolBar),
-                                          Width,
-                                          Point.y - GetWindowHeight(hToolBar),
-                                          SWP_NOZORDER|SWP_NOACTIVATE);
-
-                /* Size RichEdit */
-                if (hdwp)
-                    hdwp = DeferWindowPos(hdwp,
-                                          hRichEdit,
-                                          0,
-                                          GetWindowWidth(hTreeView) + SPLIT_WIDTH,
-                                          Point.y + SPLIT_WIDTH,
-                                          Width,
-                                          GetClientWindowHeight(hMainWnd) - (Point.y + SPLIT_WIDTH + GetWindowHeight(hStatusBar)),
-                                          SWP_NOZORDER|SWP_NOACTIVATE);
-
-                if (hdwp)
-                    EndDeferWindowPos(hdwp);
-            }
-        break;
-    }
-
-    return DefWindowProc(hwnd, Msg, wParam, lParam);
-}
-
-/* Create horizontal splitter bar */
-BOOL
-CreateHSplitBar(HWND hwnd)
-{
-    WCHAR szWindowClass[] = L"HSplitterWindowClass";
-    WNDCLASSEXW WndClass = {0};
-
-    WndClass.cbSize        = sizeof(WndClass);
-    WndClass.lpszClassName = szWindowClass;
-    WndClass.lpfnWndProc   = HSplitterWindowProc;
-    WndClass.hInstance     = hInst;
-    WndClass.style         = CS_HREDRAW | CS_VREDRAW;
-    WndClass.hCursor       = LoadCursor(0, IDC_SIZENS);
-    WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
-
-    if (RegisterClassExW(&WndClass) == (ATOM) 0)
-    {
-        /* TODO: Show error message */
-        return FALSE;
-    }
-
-    hHSplitter = CreateWindowExW(WS_EX_TRANSPARENT,
-                                 szWindowClass,
-                                 NULL,
-                                 WS_CHILD | WS_VISIBLE,
-                                 205, 180, 465, SPLIT_WIDTH,
-                                 hwnd,
-                                 NULL,
-                                 hInst,
-                                 NULL);
-
-
-    if (hHSplitter == NULL)
-    {
-        /* TODO: Show error message */
-        return FALSE;
-    }
-
-    ShowWindow(hHSplitter, SW_SHOW);
-    UpdateWindow(hHSplitter);
-
-    return TRUE;
-}
-
-/* Callback for vertical splitter bar */
-LRESULT CALLBACK
-VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
-{
-    switch (Msg)
-    {
-        case WM_LBUTTONDOWN:
-            SetCapture(hwnd);
-        break;
-
-        case WM_LBUTTONUP:
-        case WM_RBUTTONDOWN:
-            if (GetCapture() == hwnd)
-            {
-                ReleaseCapture();
-            }
-        break;
-
-        case WM_MOUSEMOVE:
-            if (GetCapture() == hwnd)
-            {
-                HDWP hdwp;
-                POINT Point;
-
-                GetCursorPos(&Point);
-                ScreenToClient(hMainWnd, &Point);
-
-                if ((GetClientWindowWidth(hMainWnd) - SPLIT_WIDTH) < Point.x)
-                    break;
-
-                if (SPLIT_WIDTH > Point.x)
-                    break;
-
-                hdwp = BeginDeferWindowPos(5);
-
-                /* Size VSplitBar */
-                if (hdwp)
-                    hdwp = DeferWindowPos(hdwp,
-                                          hwnd,
-                                          0,
-                                          Point.x,
-                                          GetWindowHeight(hToolBar),
-                                          SPLIT_WIDTH,
-                                          GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
-                                          SWP_NOZORDER|SWP_NOACTIVATE);
-
-                /* Size TreeView */
-                if (hdwp)
-                    hdwp = DeferWindowPos(hdwp,
-                                          hTreeView,
-                                          0,
-                                          0,
-                                          GetWindowHeight(hToolBar),
-                                          Point.x,
-                                          GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
-                                          SWP_NOZORDER|SWP_NOACTIVATE);
-
-                /* Size ListView */
-                if (hdwp)
-                    hdwp = DeferWindowPos(hdwp,
-                                          hListView,
-                                          0,
-                                          Point.x + SPLIT_WIDTH,
-                                          GetWindowHeight(hToolBar),
-                                          GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH),
-                                          GetHSplitterPos() - GetWindowHeight(hToolBar),
-                                          SWP_NOZORDER|SWP_NOACTIVATE);
-
-                if (hdwp)
-                    hdwp = DeferWindowPos(hdwp,
-                                          hRichEdit,
-                                          0,
-                                          Point.x + SPLIT_WIDTH,
-                                          GetHSplitterPos() + SPLIT_WIDTH,
-                                          GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH),
-                                          GetClientWindowHeight(hMainWnd) - (GetHSplitterPos() + SPLIT_WIDTH + GetWindowHeight(hStatusBar)),
-                                          SWP_NOZORDER|SWP_NOACTIVATE);
-
-                if (hdwp)
-                    hdwp = DeferWindowPos(hdwp,
-                                          hHSplitter,
-                                          0,
-                                          Point.x + SPLIT_WIDTH,
-                                          GetHSplitterPos(),
-                                          GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH),
-                                          SPLIT_WIDTH,
-                                          SWP_NOZORDER|SWP_NOACTIVATE);
-
-                if (hdwp)
-                    EndDeferWindowPos(hdwp);
-            }
-        break;
-    }
-
-    return DefWindowProc(hwnd, Msg, wParam, lParam);
-}
-
-/* Create vertical splitter bar */
-BOOL
-CreateVSplitBar(HWND hwnd)
-{
-    WCHAR szWindowClass[] = L"VSplitterWindowClass";
-    WNDCLASSEXW WndClass = {0};
-
-    WndClass.cbSize        = sizeof(WndClass);
-    WndClass.lpszClassName = szWindowClass;
-    WndClass.lpfnWndProc   = VSplitterWindowProc;
-    WndClass.hInstance     = hInst;
-    WndClass.style         = CS_HREDRAW | CS_VREDRAW;
-    WndClass.hCursor       = LoadCursor(0, IDC_SIZEWE);
-    WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
-
-    if (RegisterClassExW(&WndClass) == (ATOM) 0)
-    {
-        /* TODO: Show error message */
-        return FALSE;
-    }
-
-    hVSplitter = CreateWindowExW(WS_EX_TRANSPARENT,
-                                 szWindowClass,
-                                 NULL,
-                                 WS_CHILD | WS_VISIBLE,
-                                 201, 28, SPLIT_WIDTH, 350,
-                                 hwnd,
-                                 NULL,
-                                 hInst,
-                                 NULL);
-
-
-    if (!hVSplitter)
-    {
-        /* TODO: Show error message */
-        return FALSE;
-    }
-
-    ShowWindow(hVSplitter, SW_SHOW);
-    UpdateWindow(hVSplitter);
-
-    return TRUE;
-}
diff --git a/base/applications/rapps/statusbar.c b/base/applications/rapps/statusbar.c
deleted file mode 100644 (file)
index 238cd54..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/statusbar.c
- * PURPOSE:         StatusBar functions
- * PROGRAMMERS:     Dmitry Chapyshev (dmitry@reactos.org)
- */
-
-#include "rapps.h"
-
-HWND hStatusBar;
-
-BOOL
-CreateStatusBar(HWND hwnd)
-{
-    hStatusBar = CreateWindowExW(0,
-                                 STATUSCLASSNAMEW,
-                                 NULL,
-                                 WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP,
-                                 0, 0, 0, 0,
-                                 hwnd,
-                                 (HMENU)IDC_STATUSBAR,
-                                 hInst,
-                                 NULL);
-
-    if (!hStatusBar)
-    {
-        /* TODO: Show error message */
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
-VOID
-SetStatusBarText(LPCWSTR lpszText)
-{
-    if (hStatusBar)
-    {
-        SendMessageW(hStatusBar, SB_SETTEXT, SBT_NOBORDERS, (LPARAM)lpszText);
-    }
-}
diff --git a/base/applications/rapps/toolbar.c b/base/applications/rapps/toolbar.c
deleted file mode 100644 (file)
index 433d9ac..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/toolbar.c
- * PURPOSE:         ToolBar functions
- * PROGRAMMERS:     Dmitry Chapyshev (dmitry@reactos.org)
- */
-
-#include "rapps.h"
-
-#define TOOLBAR_HEIGHT 24
-
-HWND hToolBar;
-HWND hSearchBar;
-
-static WCHAR szInstallBtn[MAX_STR_LEN];
-static WCHAR szUninstallBtn[MAX_STR_LEN];
-static WCHAR szModifyBtn[MAX_STR_LEN];
-
-/* Toolbar buttons */
-static const TBBUTTON Buttons[] =
-{   /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
-    { 0, ID_INSTALL,   TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szInstallBtn},
-    { 1, ID_UNINSTALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szUninstallBtn},
-    { 2, ID_MODIFY,    TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, (INT_PTR)szModifyBtn},
-    { 5, 0,            TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
-    { 3, ID_REFRESH,   TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, 0},
-    { 4, ID_RESETDB,   TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, 0},
-    { 5, 0,            TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
-    { 5, ID_SETTINGS,  TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, 0},
-    { 6, ID_EXIT,      TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {0}, 0, 0}
-};
-
-
-VOID
-ToolBarOnGetDispInfo(LPTOOLTIPTEXT lpttt)
-{
-    UINT idButton = (UINT)lpttt->hdr.idFrom;
-
-    switch (idButton)
-    {
-        case ID_EXIT:
-            lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EXIT);
-            break;
-
-        case ID_INSTALL:
-            lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_INSTALL);
-            break;
-
-        case ID_UNINSTALL:
-            lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_UNINSTALL);
-            break;
-
-        case ID_MODIFY:
-            lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_MODIFY);
-            break;
-
-        case ID_SETTINGS:
-            lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_SETTINGS);
-            break;
-
-        case ID_REFRESH:
-            lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_REFRESH);
-            break;
-            
-        case ID_RESETDB:
-            lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_UPDATE_DB);
-            break;
-    }
-}
-
-VOID
-AddImageToImageList(HIMAGELIST hImageList, UINT ImageIndex)
-{
-    HANDLE hImage;
-
-    if (!(hImage = LoadImage(hInst,
-                             MAKEINTRESOURCE(ImageIndex),
-                             IMAGE_ICON,
-                             TOOLBAR_HEIGHT,
-                             TOOLBAR_HEIGHT,
-                             0)))
-    {
-        /* TODO: Error message */
-    }
-
-    ImageList_AddIcon(hImageList, hImage);
-    DeleteObject(hImage);
-}
-
-HIMAGELIST
-InitImageList(VOID)
-{
-    HIMAGELIST hImageList;
-
-    /* Create the toolbar icon image list */
-    hImageList = ImageList_Create(TOOLBAR_HEIGHT,//GetSystemMetrics(SM_CXSMICON),
-                                  TOOLBAR_HEIGHT,//GetSystemMetrics(SM_CYSMICON),
-                                  ILC_MASK | GetSystemColorDepth(),
-                                  1,
-                                  1);
-    if (!hImageList)
-    {
-        /* TODO: Error message */
-        return NULL;
-    }
-
-    AddImageToImageList(hImageList, IDI_INSTALL);
-    AddImageToImageList(hImageList, IDI_UNINSTALL);
-    AddImageToImageList(hImageList, IDI_MODIFY);
-    AddImageToImageList(hImageList, IDI_REFRESH);
-    AddImageToImageList(hImageList, IDI_UPDATE_DB);
-    AddImageToImageList(hImageList, IDI_SETTINGS);
-    AddImageToImageList(hImageList, IDI_EXIT);
-
-    return hImageList;
-}
-
-static
-BOOL
-CreateSearchBar(VOID)
-{
-    WCHAR szBuf[MAX_STR_LEN];
-
-    hSearchBar = CreateWindowExW(WS_EX_CLIENTEDGE,
-                                 L"Edit",
-                                 NULL,
-                                 WS_CHILD | WS_VISIBLE | ES_LEFT | ES_AUTOHSCROLL, 
-                                 0,
-                                 5,
-                                 200,
-                                 22,
-                                 hToolBar,
-                                 (HMENU)0,
-                                 hInst,
-                                 0);
-
-    SendMessageW(hSearchBar, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
-
-    LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
-    SetWindowTextW(hSearchBar, szBuf);
-
-    SetParent(hSearchBar, hToolBar); 
-
-    return TRUE;
-}
-
-BOOL
-CreateToolBar(HWND hwnd)
-{
-    INT NumButtons = _countof(Buttons);
-    HIMAGELIST hImageList;
-
-    LoadStringW(hInst, IDS_INSTALL, szInstallBtn, _countof(szInstallBtn));
-    LoadStringW(hInst, IDS_UNINSTALL, szUninstallBtn, _countof(szUninstallBtn));
-    LoadStringW(hInst, IDS_MODIFY, szModifyBtn, _countof(szModifyBtn));
-
-    hToolBar = CreateWindowExW(0,
-                               TOOLBARCLASSNAMEW,
-                               NULL,
-                               WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | TBSTYLE_LIST,
-                               0, 0, 0, 0,
-                               hwnd,
-                               0,
-                               hInst,
-                               NULL);
-
-    if (!hToolBar)
-    {
-        /* TODO: Show error message */
-        return FALSE;
-    }
-
-    SendMessageW(hToolBar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_HIDECLIPPEDBUTTONS);
-    SendMessageW(hToolBar, TB_BUTTONSTRUCTSIZE, sizeof(Buttons[0]), 0);
-
-    hImageList = InitImageList();
-
-    if (!hImageList)
-    {
-        /* TODO: Show error message */
-        return FALSE;
-    }
-
-    ImageList_Destroy((HIMAGELIST)SendMessageW(hToolBar,
-                                               TB_SETIMAGELIST,
-                                               0,
-                                               (LPARAM)hImageList));
-
-    SendMessageW(hToolBar, TB_ADDBUTTONS, NumButtons, (LPARAM)Buttons);
-
-    CreateSearchBar();
-
-    return TRUE;
-}
diff --git a/base/applications/rapps/treeview.c b/base/applications/rapps/treeview.c
deleted file mode 100644 (file)
index 44642d9..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/treeview.c
- * PURPOSE:         TreeView functions
- * PROGRAMMERS:     Dmitry Chapyshev (dmitry@reactos.org)
- */
-
-#include "rapps.h"
-
-HWND hTreeView;
-
-HTREEITEM
-TreeViewAddItem(HTREEITEM hParent, LPWSTR lpText, INT Image, INT SelectedImage, LPARAM lParam)
-{
-    TV_INSERTSTRUCTW Insert;
-
-    ZeroMemory(&Insert, sizeof(Insert));
-
-    Insert.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
-    Insert.hInsertAfter = TVI_LAST;
-    Insert.hParent = hParent;
-    Insert.item.iSelectedImage = SelectedImage;
-    Insert.item.iImage = Image;
-    Insert.item.lParam = lParam;
-    Insert.item.pszText = lpText;
-
-    return TreeView_InsertItem(hTreeView, &Insert);
-}
-
-BOOL
-CreateTreeView(HWND hwnd)
-{
-    hTreeView = CreateWindowExW(WS_EX_CLIENTEDGE,
-                                WC_TREEVIEWW,
-                                L"",
-                                WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_SHOWSELALWAYS,
-                                0, 28, 200, 350,
-                                hwnd,
-                                NULL,
-                                hInst,
-                                NULL);
-
-    if (!hListView)
-    {
-        /* TODO: Show error message */
-        return FALSE;
-    }
-
-    SetFocus(hTreeView);
-
-    return TRUE;
-}
diff --git a/base/applications/rapps/winmain.c b/base/applications/rapps/winmain.c
deleted file mode 100644 (file)
index 92c9bfa..0000000
+++ /dev/null
@@ -1,999 +0,0 @@
-/*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/winmain.c
- * PURPOSE:         Main program
- * PROGRAMMERS:     Dmitry Chapyshev           (dmitry@reactos.org)
- *                  Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
- */
-
-#include "rapps.h"
-
-#include <shellapi.h>
-
-#define SEARCH_TIMER_ID 'SR'
-
-HWND hMainWnd;
-HINSTANCE hInst;
-HIMAGELIST hImageTreeView = NULL;
-INT SelectedEnumType = ENUM_ALL_COMPONENTS;
-SETTINGS_INFO SettingsInfo;
-
-WCHAR szSearchPattern[MAX_STR_LEN] = L"";
-BOOL SearchEnabled = TRUE;
-
-BOOL
-SearchPatternMatch(PCWSTR szHaystack, PCWSTR szNeedle)
-{
-    if (!*szNeedle)
-        return TRUE;
-    /* TODO: Improve pattern search beyond a simple case-insensitive substring search. */
-    return StrStrIW(szHaystack, szNeedle) != NULL;
-}
-
-VOID
-FillDefaultSettings(PSETTINGS_INFO pSettingsInfo)
-{
-    pSettingsInfo->bSaveWndPos = TRUE;
-    pSettingsInfo->bUpdateAtStart = FALSE;
-    pSettingsInfo->bLogEnabled = TRUE;
-    StringCbCopyW(pSettingsInfo->szDownloadDir,
-                  sizeof(pSettingsInfo->szDownloadDir),
-                  L"C:\\Downloads");
-    pSettingsInfo->bDelInstaller = FALSE;
-
-    pSettingsInfo->Maximized = FALSE;
-    pSettingsInfo->Left = CW_USEDEFAULT;
-    pSettingsInfo->Top = CW_USEDEFAULT;
-    pSettingsInfo->Width = 680;
-    pSettingsInfo->Height = 450;
-
-    pSettingsInfo->Proxy = 0;
-    StringCbCopyW(pSettingsInfo->szProxyServer, sizeof(pSettingsInfo->szProxyServer), L"");
-    StringCbCopyW(pSettingsInfo->szNoProxyFor,  sizeof(pSettingsInfo->szNoProxyFor),  L"");
-}
-
-static BOOL
-LoadSettings(VOID)
-{
-    HKEY hKey;
-    DWORD dwSize;
-
-    if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
-    {
-        dwSize = sizeof(SettingsInfo);
-        if (RegQueryValueExW(hKey, L"Settings", NULL, NULL, (LPBYTE)&SettingsInfo, &dwSize) == ERROR_SUCCESS)
-        {
-            RegCloseKey(hKey);
-            return TRUE;
-        }
-
-        RegCloseKey(hKey);
-    }
-
-    return FALSE;
-}
-
-VOID
-SaveSettings(HWND hwnd)
-{
-    WINDOWPLACEMENT wp;
-    HKEY hKey;
-
-    if (SettingsInfo.bSaveWndPos)
-    {
-        wp.length = sizeof(wp);
-        GetWindowPlacement(hwnd, &wp);
-
-        SettingsInfo.Left = wp.rcNormalPosition.left;
-        SettingsInfo.Top  = wp.rcNormalPosition.top;
-        SettingsInfo.Width  = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
-        SettingsInfo.Height = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top;
-        SettingsInfo.Maximized = (wp.showCmd == SW_MAXIMIZE || (wp.showCmd == SW_SHOWMINIMIZED && (wp.flags & WPF_RESTORETOMAXIMIZED)));
-    }
-
-    if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0, NULL,
-        REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
-    {
-        RegSetValueExW(hKey, L"Settings", 0, REG_BINARY, (LPBYTE)&SettingsInfo, sizeof(SettingsInfo));
-        RegCloseKey(hKey);
-    }
-}
-
-VOID
-FreeInstalledAppList(VOID)
-{
-    INT Count = ListView_GetItemCount(hListView) - 1;
-    PINSTALLED_INFO Info;
-
-    while (Count >= 0)
-    {
-        Info = ListViewGetlParam(Count);
-        if (Info)
-        {
-            RegCloseKey(Info->hSubKey);
-            HeapFree(GetProcessHeap(), 0, Info);
-        }
-        Count--;
-    }
-}
-
-BOOL
-CALLBACK
-EnumInstalledAppProc(INT ItemIndex, LPWSTR lpName, PINSTALLED_INFO Info)
-{
-    PINSTALLED_INFO ItemInfo;
-    WCHAR szText[MAX_PATH];
-    INT Index;
-
-    if (!SearchPatternMatch(lpName, szSearchPattern))
-    {
-        RegCloseKey(Info->hSubKey);
-        return TRUE;
-    }
-
-    ItemInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(INSTALLED_INFO));
-    if (!ItemInfo)
-    {
-        RegCloseKey(Info->hSubKey);
-        return FALSE;
-    }
-
-    RtlCopyMemory(ItemInfo, Info, sizeof(INSTALLED_INFO));
-
-    Index = ListViewAddItem(ItemIndex, 0, lpName, (LPARAM)ItemInfo);
-
-    /* Get version info */
-    GetApplicationString(ItemInfo->hSubKey, L"DisplayVersion", szText);
-    ListView_SetItemText(hListView, Index, 1, szText);
-
-    /* Get comments */
-    GetApplicationString(ItemInfo->hSubKey, L"Comments", szText);
-    ListView_SetItemText(hListView, Index, 2, szText);
-
-    return TRUE;
-}
-
-BOOL
-CALLBACK
-EnumAvailableAppProc(PAPPLICATION_INFO Info)
-{
-    INT Index;
-
-    if (!SearchPatternMatch(Info->szName, szSearchPattern) &&
-        !SearchPatternMatch(Info->szDesc, szSearchPattern))
-    {
-        return TRUE;
-    }
-
-    /* Only add a ListView entry if...
-         - no RegName was supplied (so we cannot determine whether the application is installed or not) or
-         -  a RegName was supplied and the application is not installed
-    */
-    if (!*Info->szRegName || (!IsInstalledApplication(Info->szRegName, FALSE) && !IsInstalledApplication(Info->szRegName, TRUE)))
-    {
-        Index = ListViewAddItem(Info->Category, 0, Info->szName, (LPARAM)Info);
-
-        ListView_SetItemText(hListView, Index, 1, Info->szVersion);
-        ListView_SetItemText(hListView, Index, 2, Info->szDesc);
-    }
-
-    return TRUE;
-}
-
-VOID
-UpdateApplicationsList(INT EnumType)
-{
-    WCHAR szBuffer1[MAX_STR_LEN], szBuffer2[MAX_STR_LEN];
-    HICON hIcon;
-    HIMAGELIST hImageListView;
-
-    SendMessage(hListView, WM_SETREDRAW, FALSE, 0);
-
-    if (EnumType == -1) EnumType = SelectedEnumType;
-
-    if (IS_INSTALLED_ENUM(SelectedEnumType))
-        FreeInstalledAppList();
-
-    (VOID) ListView_DeleteAllItems(hListView);
-
-    /* Create image list */
-    hImageListView = ImageList_Create(LISTVIEW_ICON_SIZE,
-                                      LISTVIEW_ICON_SIZE,
-                                      GetSystemColorDepth() | ILC_MASK,
-                                      0, 1);
-
-    hIcon = LoadImage(hInst,
-                      MAKEINTRESOURCE(IDI_MAIN),
-                      IMAGE_ICON,
-                      LISTVIEW_ICON_SIZE,
-                      LISTVIEW_ICON_SIZE,
-                      LR_CREATEDIBSECTION);
-
-    ImageList_AddIcon(hImageListView, hIcon);
-    DestroyIcon(hIcon);
-
-    if (IS_INSTALLED_ENUM(EnumType))
-    {
-        /* Enum installed applications and updates */
-        EnumInstalledApplications(EnumType, TRUE, EnumInstalledAppProc);
-        EnumInstalledApplications(EnumType, FALSE, EnumInstalledAppProc);
-    }
-    else if (IS_AVAILABLE_ENUM(EnumType))
-    {
-        /* Enum available applications */
-        EnumAvailableApplications(EnumType, EnumAvailableAppProc);
-    }
-
-    /* Set image list for ListView */
-    hImageListView = ListView_SetImageList(hListView, hImageListView, LVSIL_SMALL);
-
-    /* Destroy old image list */
-    if (hImageListView)
-        ImageList_Destroy(hImageListView);
-
-    SelectedEnumType = EnumType;
-
-    LoadStringW(hInst, IDS_APPS_COUNT, szBuffer2, _countof(szBuffer2));
-    StringCbPrintfW(szBuffer1, sizeof(szBuffer1),
-                    szBuffer2,
-                    ListView_GetItemCount(hListView));
-    SetStatusBarText(szBuffer1);
-
-    SetWelcomeText();
-
-    /* set automatic column width for program names if the list is not empty */
-    if (ListView_GetItemCount(hListView) > 0)
-        ListView_SetColumnWidth(hListView, 0, LVSCW_AUTOSIZE);
-
-    SendMessage(hListView, WM_SETREDRAW, TRUE, 0);
-}
-
-VOID
-InitApplicationsList(VOID)
-{
-    WCHAR szText[MAX_STR_LEN];
-
-    /* Add columns to ListView */
-    LoadStringW(hInst, IDS_APP_NAME, szText, _countof(szText));
-    ListViewAddColumn(0, szText, 200, LVCFMT_LEFT);
-
-    LoadStringW(hInst, IDS_APP_INST_VERSION, szText, _countof(szText));
-    ListViewAddColumn(1, szText, 90, LVCFMT_RIGHT);
-
-    LoadStringW(hInst, IDS_APP_DESCRIPTION, szText, _countof(szText));
-    ListViewAddColumn(3, szText, 250, LVCFMT_LEFT);
-
-    UpdateApplicationsList(ENUM_ALL_COMPONENTS);
-}
-
-HTREEITEM
-AddCategory(HTREEITEM hRootItem, UINT TextIndex, UINT IconIndex)
-{
-    WCHAR szText[MAX_STR_LEN];
-    INT Index;
-    HICON hIcon;
-
-    hIcon = LoadImage(hInst,
-                      MAKEINTRESOURCE(IconIndex),
-                      IMAGE_ICON,
-                      TREEVIEW_ICON_SIZE,
-                      TREEVIEW_ICON_SIZE,
-                      LR_CREATEDIBSECTION);
-
-    Index = ImageList_AddIcon(hImageTreeView, hIcon);
-    DestroyIcon(hIcon);
-
-    LoadStringW(hInst, TextIndex, szText, _countof(szText));
-
-    return TreeViewAddItem(hRootItem, szText, Index, Index, TextIndex);
-}
-
-VOID
-InitCategoriesList(VOID)
-{
-    HTREEITEM hRootItem1, hRootItem2;
-
-    /* Create image list */
-    hImageTreeView = ImageList_Create(TREEVIEW_ICON_SIZE,
-                                      TREEVIEW_ICON_SIZE,
-                                      GetSystemColorDepth() | ILC_MASK,
-                                      0, 1);
-
-    hRootItem1 = AddCategory(TVI_ROOT, IDS_INSTALLED, IDI_CATEGORY);
-    AddCategory(hRootItem1, IDS_APPLICATIONS, IDI_APPS);
-    AddCategory(hRootItem1, IDS_UPDATES, IDI_APPUPD);
-
-    hRootItem2 = AddCategory(TVI_ROOT, IDS_AVAILABLEFORINST, IDI_CATEGORY);
-    AddCategory(hRootItem2, IDS_CAT_AUDIO, IDI_CAT_AUDIO);
-    AddCategory(hRootItem2, IDS_CAT_VIDEO, IDI_CAT_VIDEO);
-    AddCategory(hRootItem2, IDS_CAT_GRAPHICS, IDI_CAT_GRAPHICS);
-    AddCategory(hRootItem2, IDS_CAT_GAMES, IDI_CAT_GAMES);
-    AddCategory(hRootItem2, IDS_CAT_INTERNET, IDI_CAT_INTERNET);
-    AddCategory(hRootItem2, IDS_CAT_OFFICE, IDI_CAT_OFFICE);
-    AddCategory(hRootItem2, IDS_CAT_DEVEL, IDI_CAT_DEVEL);
-    AddCategory(hRootItem2, IDS_CAT_EDU, IDI_CAT_EDU);
-    AddCategory(hRootItem2, IDS_CAT_ENGINEER, IDI_CAT_ENGINEER);
-    AddCategory(hRootItem2, IDS_CAT_FINANCE, IDI_CAT_FINANCE);
-    AddCategory(hRootItem2, IDS_CAT_SCIENCE, IDI_CAT_SCIENCE);
-    AddCategory(hRootItem2, IDS_CAT_TOOLS, IDI_CAT_TOOLS);
-    AddCategory(hRootItem2, IDS_CAT_DRIVERS, IDI_CAT_DRIVERS);
-    AddCategory(hRootItem2, IDS_CAT_LIBS, IDI_CAT_LIBS);
-    AddCategory(hRootItem2, IDS_CAT_OTHER, IDI_CAT_OTHER);
-
-    (VOID) TreeView_SetImageList(hTreeView, hImageTreeView, TVSIL_NORMAL);
-
-    (VOID) TreeView_Expand(hTreeView, hRootItem2, TVE_EXPAND);
-    (VOID) TreeView_Expand(hTreeView, hRootItem1, TVE_EXPAND);
-
-    (VOID) TreeView_SelectItem(hTreeView, hRootItem1);
-}
-
-BOOL
-InitControls(HWND hwnd)
-{
-
-    if (CreateStatusBar(hwnd) &&
-        CreateToolBar(hwnd)   &&
-        CreateListView(hwnd)  &&
-        CreateTreeView(hwnd)  &&
-        CreateRichEdit(hwnd)  &&
-        CreateVSplitBar(hwnd) &&
-        CreateHSplitBar(hwnd))
-    {
-        WCHAR szBuffer1[MAX_STR_LEN], szBuffer2[MAX_STR_LEN];
-
-        InitApplicationsList();
-
-        InitCategoriesList();
-
-        LoadStringW(hInst, IDS_APPS_COUNT, szBuffer2, _countof(szBuffer2));
-        StringCbPrintfW(szBuffer1, sizeof(szBuffer1),
-                        szBuffer2,
-                        ListView_GetItemCount(hListView));
-        SetStatusBarText(szBuffer1);
-        return TRUE;
-    }
-
-    return FALSE;
-}
-
-VOID CALLBACK
-SearchTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
-{
-    KillTimer(hwnd, SEARCH_TIMER_ID);
-    UpdateApplicationsList(-1);
-}
-
-VOID
-MainWndOnCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    WORD wCommand = LOWORD(wParam);
-
-    if (lParam == (LPARAM)hSearchBar)
-    {
-        WCHAR szBuf[MAX_STR_LEN];
-
-        switch (HIWORD(wParam))
-        {
-            case EN_SETFOCUS:
-            {
-                WCHAR szWndText[MAX_STR_LEN];
-
-                LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
-                GetWindowTextW(hSearchBar, szWndText, MAX_STR_LEN);
-                if (wcscmp(szBuf, szWndText) == 0)
-                {
-                    SearchEnabled = FALSE;
-                    SetWindowTextW(hSearchBar, L"");
-                }
-            }
-            break;
-
-            case EN_KILLFOCUS:
-            {
-                GetWindowTextW(hSearchBar, szBuf, MAX_STR_LEN);
-                if (wcslen(szBuf) < 1)
-                {
-                    LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
-                    SearchEnabled = FALSE;
-                    SetWindowTextW(hSearchBar, szBuf);
-                }
-            }
-            break;
-
-            case EN_CHANGE:
-            {
-                WCHAR szWndText[MAX_STR_LEN];
-
-                if (!SearchEnabled)
-                {
-                    SearchEnabled = TRUE;
-                    break;
-                }
-
-                LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
-                GetWindowTextW(hSearchBar, szWndText, MAX_STR_LEN);
-                if (wcscmp(szBuf, szWndText) != 0)
-                {
-                    StringCbCopy(szSearchPattern, sizeof(szSearchPattern),
-                                 szWndText);
-                }
-                else
-                {
-                    szSearchPattern[0] = UNICODE_NULL;
-                }
-
-                SetTimer(hwnd, SEARCH_TIMER_ID, 250, SearchTimerProc);
-            }
-            break;
-        }
-
-        return;
-    }
-
-    switch (wCommand)
-    {
-        case ID_OPEN_LINK:
-            ShellExecuteW(hwnd, L"open", pLink, NULL, NULL, SW_SHOWNOACTIVATE);
-            HeapFree(GetProcessHeap(), 0, pLink);
-            break;
-
-        case ID_COPY_LINK:
-            CopyTextToClipboard(pLink);
-            HeapFree(GetProcessHeap(), 0, pLink);
-            break;
-
-        case ID_SETTINGS:
-            CreateSettingsDlg(hwnd);
-            break;
-
-        case ID_EXIT:
-            PostMessageW(hwnd, WM_CLOSE, 0, 0);
-            break;
-
-        case ID_INSTALL:
-            if (DownloadApplication(-1))
-            /* TODO: Implement install dialog
-             *   if (InstallApplication(-1))
-             */
-                UpdateApplicationsList(-1);
-            break;
-
-        case ID_UNINSTALL:
-            if (UninstallApplication(-1, FALSE))
-                UpdateApplicationsList(-1);
-            break;
-
-        case ID_MODIFY:
-            if (UninstallApplication(-1, TRUE))
-                UpdateApplicationsList(-1);
-            break;
-
-        case ID_REGREMOVE:
-            RemoveAppFromRegistry(-1);
-            break;
-
-        case ID_REFRESH:
-            UpdateApplicationsList(-1);
-            break;
-
-        case ID_RESETDB:
-            UpdateAppsDB();
-            UpdateApplicationsList(-1);
-            break;
-
-        case ID_HELP:
-            MessageBoxW(hwnd, L"Help not implemented yet", NULL, MB_OK);
-            break;
-
-        case ID_ABOUT:
-            ShowAboutDialog();
-            break;
-    }
-}
-
-VOID
-MainWndOnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
-{
-    HDWP hdwp = BeginDeferWindowPos(5);
-    INT SearchBarWidth = GetWindowWidth(hSearchBar);
-    INT RichPos = GetWindowHeight(hRichEdit);
-    INT NewPos = HIWORD(lParam) - (RichPos + SPLIT_WIDTH + GetWindowHeight(hStatusBar));
-    INT VSplitterPos;
-
-    /* Size status bar */
-    SendMessage(hStatusBar, WM_SIZE, 0, 0);
-
-    /* Size tool bar */
-    SendMessage(hToolBar, TB_AUTOSIZE, 0, 0);
-
-    /* Size SearchBar */
-    MoveWindow(hSearchBar, LOWORD(lParam) - SearchBarWidth - 4, 5, SearchBarWidth, 22, TRUE);
-
-    /*
-     * HIWORD(lParam) - Height of main window
-     * LOWORD(lParam) - Width of main window
-     */
-
-    /* Size vertical splitter bar */
-    if (hdwp)
-        hdwp = DeferWindowPos(hdwp,
-                              hVSplitter,
-                              0,
-                              (VSplitterPos = GetWindowWidth(hTreeView)),
-                              GetWindowHeight(hToolBar),
-                              SPLIT_WIDTH,
-                              HIWORD(lParam) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
-                              SWP_NOZORDER|SWP_NOACTIVATE);
-
-    /* Size TreeView */
-    if (hdwp)
-        hdwp = DeferWindowPos(hdwp,
-                              hTreeView,
-                              0,
-                              0,
-                              GetWindowHeight(hToolBar),
-                              VSplitterPos,
-                              HIWORD(lParam) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar),
-                              SWP_NOZORDER|SWP_NOACTIVATE);
-
-    if(wParam != SIZE_MINIMIZED)
-    {
-        while (NewPos < SPLIT_WIDTH + GetWindowHeight(hToolBar))
-        {
-            RichPos--;
-            NewPos = HIWORD(lParam) - (RichPos +
-                     SPLIT_WIDTH + GetWindowHeight(hStatusBar));
-        }
-    }
-    SetHSplitterPos(NewPos);
-
-    /* Size ListView */
-    if (hdwp)
-        hdwp = DeferWindowPos(hdwp,
-                              hListView,
-                              0,
-                              VSplitterPos + SPLIT_WIDTH,
-                              GetWindowHeight(hToolBar),
-                              LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH),
-                              GetHSplitterPos() - GetWindowHeight(hToolBar),
-                              SWP_NOZORDER|SWP_NOACTIVATE);
-
-    /* Size RichEdit */
-    if (hdwp)
-        hdwp = DeferWindowPos(hdwp,
-                              hRichEdit,
-                              0,
-                              VSplitterPos + SPLIT_WIDTH,
-                              GetHSplitterPos() + SPLIT_WIDTH,
-                              LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH),
-                              RichPos,
-                              SWP_NOZORDER|SWP_NOACTIVATE);
-
-    /* Size horizontal splitter bar */
-    if (hdwp)
-        hdwp = DeferWindowPos(hdwp,
-                              hHSplitter,
-                              0,
-                              VSplitterPos + SPLIT_WIDTH,
-                              GetHSplitterPos(),
-                              LOWORD(lParam) - (VSplitterPos + SPLIT_WIDTH),
-                              SPLIT_WIDTH,
-                              SWP_NOZORDER|SWP_NOACTIVATE);
-
-    if (hdwp)
-        EndDeferWindowPos(hdwp);
-}
-
-BOOL IsSelectedNodeInstalled(void)
-{
-    HTREEITEM hSelectedItem = TreeView_GetSelection(hTreeView);
-    TV_ITEM tItem;
-
-    tItem.mask = TVIF_PARAM | TVIF_HANDLE;
-    tItem.hItem = hSelectedItem;
-    TreeView_GetItem(hTreeView, &tItem);
-    switch (tItem.lParam)
-    {
-        case IDS_INSTALLED:
-        case IDS_APPLICATIONS:
-        case IDS_UPDATES:
-            return TRUE;
-        default:
-            return FALSE;
-    }
-}
-
-LRESULT CALLBACK
-MainWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
-{
-
-    switch (Msg)
-    {
-        case WM_CREATE:
-            if (!InitControls(hwnd))
-                PostMessage(hwnd, WM_CLOSE, 0, 0);
-            break;
-
-        case WM_COMMAND:
-            MainWndOnCommand(hwnd, wParam, lParam);
-            break;
-
-        case WM_NOTIFY:
-        {
-            LPNMHDR data = (LPNMHDR)lParam;
-
-            switch (data->code)
-            {
-                case TVN_SELCHANGED:
-                {
-                    if (data->hwndFrom == hTreeView)
-                    {
-                        switch (((LPNMTREEVIEW)lParam)->itemNew.lParam)
-                        {
-                            case IDS_INSTALLED:
-                                UpdateApplicationsList(ENUM_ALL_COMPONENTS);
-                                break;
-
-                            case IDS_APPLICATIONS:
-                                UpdateApplicationsList(ENUM_APPLICATIONS);
-                                break;
-
-                            case IDS_UPDATES:
-                                UpdateApplicationsList(ENUM_UPDATES);
-                                break;
-
-                            case IDS_AVAILABLEFORINST:
-                                UpdateApplicationsList(ENUM_ALL_AVAILABLE);
-                                break;
-
-                            case IDS_CAT_AUDIO:
-                                UpdateApplicationsList(ENUM_CAT_AUDIO);
-                                break;
-
-                            case IDS_CAT_DEVEL:
-                                UpdateApplicationsList(ENUM_CAT_DEVEL);
-                                break;
-
-                            case IDS_CAT_DRIVERS:
-                                UpdateApplicationsList(ENUM_CAT_DRIVERS);
-                                break;
-
-                            case IDS_CAT_EDU:
-                                UpdateApplicationsList(ENUM_CAT_EDU);
-                                break;
-
-                            case IDS_CAT_ENGINEER:
-                                UpdateApplicationsList(ENUM_CAT_ENGINEER);
-                                break;
-
-                            case IDS_CAT_FINANCE:
-                                UpdateApplicationsList(ENUM_CAT_FINANCE);
-                                break;
-
-                            case IDS_CAT_GAMES:
-                                UpdateApplicationsList(ENUM_CAT_GAMES);
-                                break;
-
-                            case IDS_CAT_GRAPHICS:
-                                UpdateApplicationsList(ENUM_CAT_GRAPHICS);
-                                break;
-
-                            case IDS_CAT_INTERNET:
-                                UpdateApplicationsList(ENUM_CAT_INTERNET);
-                                break;
-
-                            case IDS_CAT_LIBS:
-                                UpdateApplicationsList(ENUM_CAT_LIBS);
-                                break;
-
-                            case IDS_CAT_OFFICE:
-                                UpdateApplicationsList(ENUM_CAT_OFFICE);
-                                break;
-
-                            case IDS_CAT_OTHER:
-                                UpdateApplicationsList(ENUM_CAT_OTHER);
-                                break;
-
-                            case IDS_CAT_SCIENCE:
-                                UpdateApplicationsList(ENUM_CAT_SCIENCE);
-                                break;
-
-                            case IDS_CAT_TOOLS:
-                                UpdateApplicationsList(ENUM_CAT_TOOLS);
-                                break;
-
-                            case IDS_CAT_VIDEO:
-                                UpdateApplicationsList(ENUM_CAT_VIDEO);
-                                break;
-                        }
-                    }
-
-                    /* Disable/enable items based on treeview selection */
-                    if (IsSelectedNodeInstalled())
-                    {
-                        EnableMenuItem(GetMenu(hwnd), ID_REGREMOVE, MF_ENABLED);
-                        EnableMenuItem(GetMenu(hwnd), ID_INSTALL, MF_GRAYED);
-                        EnableMenuItem(GetMenu(hwnd), ID_UNINSTALL, MF_ENABLED);
-                        EnableMenuItem(GetMenu(hwnd), ID_MODIFY, MF_ENABLED);
-
-                        EnableMenuItem(GetMenu(hListView), ID_REGREMOVE, MF_ENABLED);
-                        EnableMenuItem(GetMenu(hListView), ID_INSTALL, MF_GRAYED);
-                        EnableMenuItem(GetMenu(hListView), ID_UNINSTALL, MF_ENABLED);
-                        EnableMenuItem(GetMenu(hListView), ID_MODIFY, MF_ENABLED);
-
-                        SendMessage(hToolBar, TB_ENABLEBUTTON, ID_REGREMOVE, TRUE);
-                        SendMessage(hToolBar, TB_ENABLEBUTTON, ID_INSTALL, FALSE);
-                        SendMessage(hToolBar, TB_ENABLEBUTTON, ID_UNINSTALL, TRUE);
-                        SendMessage(hToolBar, TB_ENABLEBUTTON, ID_MODIFY, TRUE);
-                    }
-                    else
-                    {
-                        EnableMenuItem(GetMenu(hwnd), ID_REGREMOVE, MF_GRAYED);
-                        EnableMenuItem(GetMenu(hwnd), ID_INSTALL, MF_ENABLED);
-                        EnableMenuItem(GetMenu(hwnd), ID_UNINSTALL, MF_GRAYED);
-                        EnableMenuItem(GetMenu(hwnd), ID_MODIFY, MF_GRAYED);
-
-                        EnableMenuItem(GetMenu(hListView), ID_REGREMOVE, MF_GRAYED);
-                        EnableMenuItem(GetMenu(hListView), ID_INSTALL, MF_ENABLED);
-                        EnableMenuItem(GetMenu(hListView), ID_UNINSTALL, MF_GRAYED);
-                        EnableMenuItem(GetMenu(hListView), ID_MODIFY, MF_GRAYED);
-
-                        SendMessage(hToolBar, TB_ENABLEBUTTON, ID_REGREMOVE, FALSE);
-                        SendMessage(hToolBar, TB_ENABLEBUTTON, ID_INSTALL, TRUE);
-                        SendMessage(hToolBar, TB_ENABLEBUTTON, ID_UNINSTALL, FALSE);
-                        SendMessage(hToolBar, TB_ENABLEBUTTON, ID_MODIFY, FALSE);
-                    }
-                }
-                break;
-
-                case LVN_ITEMCHANGED:
-                {
-                    LPNMLISTVIEW pnic = (LPNMLISTVIEW) lParam;
-
-                    if (pnic->hdr.hwndFrom == hListView)
-                    {
-                        /* Check if this is a valid item
-                         * (technically, it can be also an unselect) */
-                        INT ItemIndex = pnic->iItem;
-                        if (ItemIndex == -1 ||
-                            ItemIndex >= ListView_GetItemCount(pnic->hdr.hwndFrom))
-                        {
-                            break;
-                        }
-
-                        /* Check if the focus has been moved to another item */
-                        if ((pnic->uChanged & LVIF_STATE) &&
-                            (pnic->uNewState & LVIS_FOCUSED) &&
-                            !(pnic->uOldState & LVIS_FOCUSED))
-                        {
-                            if (IS_INSTALLED_ENUM(SelectedEnumType))
-                                ShowInstalledAppInfo(ItemIndex);
-                            if (IS_AVAILABLE_ENUM(SelectedEnumType))
-                                ShowAvailableAppInfo(ItemIndex);
-                        }
-                    }
-                }
-                break;
-
-                case LVN_COLUMNCLICK:
-                {
-                    LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;
-
-                    (VOID) ListView_SortItems(hListView, ListViewCompareFunc, pnmv->iSubItem);
-                    bAscending = !bAscending;
-                }
-                break;
-
-                case NM_CLICK:
-                {
-                    if (data->hwndFrom == hListView && ((LPNMLISTVIEW)lParam)->iItem != -1)
-                    {
-                        if (IS_INSTALLED_ENUM(SelectedEnumType))
-                            ShowInstalledAppInfo(-1);
-                        if (IS_AVAILABLE_ENUM(SelectedEnumType))
-                            ShowAvailableAppInfo(-1);
-                    }
-                }
-                break;
-
-                case NM_DBLCLK:
-                {
-                    if (data->hwndFrom == hListView && ((LPNMLISTVIEW)lParam)->iItem != -1)
-                    {
-                        /* this won't do anything if the program is already installed */
-                        SendMessage(hwnd, WM_COMMAND, ID_INSTALL, 0);
-                    }
-                }
-                break;
-
-                case NM_RCLICK:
-                {
-                    if (data->hwndFrom == hListView && ((LPNMLISTVIEW)lParam)->iItem != -1)
-                    {
-                        ShowPopupMenu(hListView, 0, ID_INSTALL);
-                    }
-                }
-                break;
-
-                case EN_LINK:
-                    RichEditOnLink(hwnd, (ENLINK*)lParam);
-                    break;
-
-                case TTN_GETDISPINFO:
-                    ToolBarOnGetDispInfo((LPTOOLTIPTEXT)lParam);
-                    break;
-            }
-        }
-        break;
-
-        case WM_PAINT:
-        break;
-
-        case WM_SIZE:
-        {
-            if ((GetClientWindowHeight(hMainWnd) - GetWindowHeight(hStatusBar) - SPLIT_WIDTH) < GetHSplitterPos())
-            {
-                INT NewSplitPos = GetClientWindowHeight(hwnd) - 100 - GetWindowHeight(hStatusBar) - SPLIT_WIDTH;
-                if (NewSplitPos > GetWindowHeight(hToolBar) + SPLIT_WIDTH)
-                    SetHSplitterPos(NewSplitPos);
-            }
-
-            MainWndOnSize(hwnd, wParam, lParam);
-        }
-        break;
-
-        case WM_SIZING:
-        {
-            int RichEditHeight = GetWindowHeight(hRichEdit);
-            LPRECT pRect = (LPRECT)lParam;
-
-            while (RichEditHeight <= 100)
-            {
-                if (GetHSplitterPos() - 1 < GetWindowHeight(hToolBar) + GetWindowHeight(hListView) + SPLIT_WIDTH)
-                    break;
-                SetHSplitterPos(GetHSplitterPos() - 1);
-                RichEditHeight++;
-            }
-
-            if (pRect->right-pRect->left < 565)
-                pRect->right = pRect->left + 565;
-
-            if (pRect->bottom-pRect->top < 300)
-                pRect->bottom = pRect->top + 300;
-            return TRUE;
-        }
-
-        case WM_SYSCOLORCHANGE:
-        {
-            /* Forward WM_SYSCOLORCHANGE to common controls */
-            SendMessage(hListView, WM_SYSCOLORCHANGE, 0, 0);
-            SendMessage(hTreeView, WM_SYSCOLORCHANGE, 0, 0);
-            SendMessage(hToolBar, WM_SYSCOLORCHANGE, 0, 0);
-            SendMessageW(hRichEdit, EM_SETBKGNDCOLOR, 0, GetSysColor(COLOR_BTNFACE));
-        }
-        break;
-
-        case WM_DESTROY:
-        {
-            ShowWindow(hwnd, SW_HIDE);
-            SaveSettings(hwnd);
-
-            FreeLogs();
-
-            FreeCachedAvailableEntries();
-
-            if (IS_INSTALLED_ENUM(SelectedEnumType))
-                FreeInstalledAppList();
-
-            if (hImageTreeView)
-                ImageList_Destroy(hImageTreeView);
-
-            PostQuitMessage(0);
-            return 0;
-        }
-        break;
-    }
-
-    return DefWindowProc(hwnd, Msg, wParam, lParam);
-}
-
-int WINAPI
-wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
-{
-    WNDCLASSEXW WndClass = {0};
-    WCHAR szWindowClass[] = L"ROSAPPMGR";
-    WCHAR szWindowName[MAX_STR_LEN];
-    HANDLE hMutex = NULL;
-    HACCEL KeyBrd;
-    MSG Msg;
-
-    switch (GetUserDefaultUILanguage())
-    {
-        case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT):
-            SetProcessDefaultLayout(LAYOUT_RTL);
-            break;
-
-        default:
-            break;
-    }
-
-    hInst = hInstance;
-
-    hMutex = CreateMutexW(NULL, FALSE, szWindowClass);
-    if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS))
-    {
-        /* If already started, it is found its window */
-        HWND hWindow = FindWindowW(szWindowClass, NULL);
-
-        /* Activate window */
-        ShowWindow(hWindow, SW_SHOWNORMAL);
-        SetForegroundWindow(hWindow);
-        return 1;
-    }
-
-    if (!LoadSettings())
-    {
-        FillDefaultSettings(&SettingsInfo);
-    }
-
-    InitLogs();
-
-    InitCommonControls();
-
-    /* Create the window */
-    WndClass.cbSize        = sizeof(WndClass);
-    WndClass.lpszClassName = szWindowClass;
-    WndClass.lpfnWndProc   = MainWindowProc;
-    WndClass.hInstance     = hInstance;
-    WndClass.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAIN));
-    WndClass.hCursor       = LoadCursor(NULL, IDC_ARROW);
-    WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
-    WndClass.lpszMenuName  = MAKEINTRESOURCEW(IDR_MAINMENU);
-
-    if (RegisterClassExW(&WndClass) == (ATOM)0) goto Exit;
-
-    LoadStringW(hInst, IDS_APPTITLE, szWindowName, _countof(szWindowName));
-
-    hMainWnd = CreateWindowExW(WS_EX_WINDOWEDGE,
-                               szWindowClass,
-                               szWindowName,
-                               WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
-                               (SettingsInfo.bSaveWndPos ? SettingsInfo.Left   : CW_USEDEFAULT),
-                               (SettingsInfo.bSaveWndPos ? SettingsInfo.Top    : CW_USEDEFAULT),
-                               (SettingsInfo.bSaveWndPos ? SettingsInfo.Width  : 680),
-                               (SettingsInfo.bSaveWndPos ? SettingsInfo.Height : 450),
-                               NULL,
-                               NULL,
-                               hInstance,
-                               NULL);
-
-    if (!hMainWnd) goto Exit;
-
-    /* Maximize it if we must */
-    ShowWindow(hMainWnd, (SettingsInfo.bSaveWndPos && SettingsInfo.Maximized ? SW_MAXIMIZE : nShowCmd));
-    UpdateWindow(hMainWnd);
-
-    if (SettingsInfo.bUpdateAtStart)
-        UpdateAppsDB();
-
-    /* Load the menu hotkeys */
-    KeyBrd = LoadAccelerators(NULL, MAKEINTRESOURCE(HOTKEYS));
-
-    /* Message Loop */
-    while (GetMessage(&Msg, NULL, 0, 0))
-    {
-        if (!TranslateAccelerator(hMainWnd, KeyBrd, &Msg))
-        {
-            TranslateMessage(&Msg);
-            DispatchMessage(&Msg);
-        }
-    }
-
-Exit:
-    if (hMutex)
-        CloseHandle(hMutex);
-
-    return 0;
-}
diff --git a/dll/opengl/opengl32/font.c b/dll/opengl/opengl32/font.c
deleted file mode 100644 (file)
index 800b801..0000000
+++ /dev/null
@@ -1,565 +0,0 @@
-/* Window-specific OpenGL functions implementation.
- *
- * Copyright (c) 1999 Lionel Ulmer
- * Copyright (c) 2005 Raphael Junqueira
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include <stdarg.h>
-#include <math.h>
-#include <GL/gl.h>
-
-#include <windef.h>
-#include <winbase.h>
-#include <wingdi.h>
-
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(wgl);
-
-/***********************************************************************
- *             wglUseFontBitmaps_common
- */
-static BOOL wglUseFontBitmaps_common( HDC hdc, DWORD first, DWORD count, DWORD listBase, BOOL unicode )
-{
-    GLYPHMETRICS gm;
-    unsigned int glyph, size = 0;
-    void *bitmap = NULL, *gl_bitmap = NULL;
-    int org_alignment;
-    BOOL ret = TRUE;
-
-    glGetIntegerv(GL_UNPACK_ALIGNMENT, &org_alignment);
-    glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
-
-    for (glyph = first; glyph < first + count; glyph++) {
-        static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
-        unsigned int needed_size, height, width, width_int;
-
-        if (unicode)
-            needed_size = GetGlyphOutlineW(hdc, glyph, GGO_BITMAP, &gm, 0, NULL, &identity);
-        else
-            needed_size = GetGlyphOutlineA(hdc, glyph, GGO_BITMAP, &gm, 0, NULL, &identity);
-
-        TRACE("Glyph: %3d / List: %d size %d\n", glyph, listBase, needed_size);
-        if (needed_size == GDI_ERROR) {
-            ret = FALSE;
-            break;
-        }
-
-        if (needed_size > size) {
-            size = needed_size;
-            HeapFree(GetProcessHeap(), 0, bitmap);
-            HeapFree(GetProcessHeap(), 0, gl_bitmap);
-            bitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
-            gl_bitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
-        }
-        if (unicode)
-            ret = (GetGlyphOutlineW(hdc, glyph, GGO_BITMAP, &gm, size, bitmap, &identity) != GDI_ERROR);
-        else
-            ret = (GetGlyphOutlineA(hdc, glyph, GGO_BITMAP, &gm, size, bitmap, &identity) != GDI_ERROR);
-        if (!ret) break;
-
-        if (TRACE_ON(wgl)) {
-            unsigned int bitmask;
-            unsigned char *bitmap_ = bitmap;
-
-            TRACE("  - bbox: %d x %d\n", gm.gmBlackBoxX, gm.gmBlackBoxY);
-            TRACE("  - origin: (%d, %d)\n", gm.gmptGlyphOrigin.x, gm.gmptGlyphOrigin.y);
-            TRACE("  - increment: %d - %d\n", gm.gmCellIncX, gm.gmCellIncY);
-            if (needed_size != 0) {
-                TRACE("  - bitmap:\n");
-                for (height = 0; height < gm.gmBlackBoxY; height++) {
-                    TRACE("      ");
-                    for (width = 0, bitmask = 0x80; width < gm.gmBlackBoxX; width++, bitmask >>= 1) {
-                        if (bitmask == 0) {
-                            bitmap_ += 1;
-                            bitmask = 0x80;
-                        }
-                        if (*bitmap_ & bitmask)
-                            TRACE("*");
-                        else
-                            TRACE(" ");
-                    }
-                bitmap_ += (4 - ((UINT_PTR)bitmap_ & 0x03));
-                TRACE("\n");
-                }
-            }
-        }
-
-        /* In OpenGL, the bitmap is drawn from the bottom to the top... So we need to invert the
-        * glyph for it to be drawn properly.
-        */
-        if (needed_size != 0) {
-            width_int = (gm.gmBlackBoxX + 31) / 32;
-            for (height = 0; height < gm.gmBlackBoxY; height++) {
-                for (width = 0; width < width_int; width++) {
-                    ((int *) gl_bitmap)[(gm.gmBlackBoxY - height - 1) * width_int + width] =
-                    ((int *) bitmap)[height * width_int + width];
-                }
-            }
-        }
-
-        glNewList(listBase++, GL_COMPILE);
-        if (needed_size != 0) {
-            glBitmap(gm.gmBlackBoxX, gm.gmBlackBoxY,
-                0 - gm.gmptGlyphOrigin.x, (int) gm.gmBlackBoxY - gm.gmptGlyphOrigin.y,
-                gm.gmCellIncX, gm.gmCellIncY,
-                gl_bitmap);
-        } else {
-            /* This is the case of 'empty' glyphs like the space character */
-            glBitmap(0, 0, 0, 0, gm.gmCellIncX, gm.gmCellIncY, NULL);
-        }
-        glEndList();
-    }
-
-    glPixelStorei(GL_UNPACK_ALIGNMENT, org_alignment);
-    HeapFree(GetProcessHeap(), 0, bitmap);
-    HeapFree(GetProcessHeap(), 0, gl_bitmap);
-    return ret;
-}
-
-/***********************************************************************
- *             wglUseFontBitmapsA (OPENGL32.@)
- */
-BOOL WINAPI wglUseFontBitmapsA(HDC hdc, DWORD first, DWORD count, DWORD listBase)
-{
-    return wglUseFontBitmaps_common( hdc, first, count, listBase, FALSE );
-}
-
-/***********************************************************************
- *             wglUseFontBitmapsW (OPENGL32.@)
- */
-BOOL WINAPI wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD listBase)
-{
-    return wglUseFontBitmaps_common( hdc, first, count, listBase, TRUE );
-}
-
-/* FIXME: should probably have a glu.h header */
-
-typedef struct GLUtesselator GLUtesselator;
-typedef void (WINAPI *_GLUfuncptr)(void);
-
-#define GLU_TESS_BEGIN  100100
-#define GLU_TESS_VERTEX 100101
-#define GLU_TESS_END    100102
-
-static GLUtesselator * (WINAPI *pgluNewTess)(void);
-static void (WINAPI *pgluDeleteTess)(GLUtesselator *tess);
-static void (WINAPI *pgluTessNormal)(GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z);
-static void (WINAPI *pgluTessBeginPolygon)(GLUtesselator *tess, void *polygon_data);
-static void (WINAPI *pgluTessEndPolygon)(GLUtesselator *tess);
-static void (WINAPI *pgluTessCallback)(GLUtesselator *tess, GLenum which, _GLUfuncptr fn);
-static void (WINAPI *pgluTessBeginContour)(GLUtesselator *tess);
-static void (WINAPI *pgluTessEndContour)(GLUtesselator *tess);
-static void (WINAPI *pgluTessVertex)(GLUtesselator *tess, GLdouble *location, GLvoid* data);
-
-static HMODULE load_libglu(void)
-{
-    static const WCHAR glu32W[] = {'g','l','u','3','2','.','d','l','l',0};
-    static int already_loaded;
-    static HMODULE module;
-
-    if (already_loaded) return module;
-    already_loaded = 1;
-
-    TRACE("Trying to load GLU library\n");
-    module = LoadLibraryW( glu32W );
-    if (!module)
-    {
-        WARN("Failed to load glu32\n");
-        return NULL;
-    }
-#define LOAD_FUNCPTR(f) p##f = (void *)GetProcAddress( module, #f )
-    LOAD_FUNCPTR(gluNewTess);
-    LOAD_FUNCPTR(gluDeleteTess);
-    LOAD_FUNCPTR(gluTessBeginContour);
-    LOAD_FUNCPTR(gluTessNormal);
-    LOAD_FUNCPTR(gluTessBeginPolygon);
-    LOAD_FUNCPTR(gluTessCallback);
-    LOAD_FUNCPTR(gluTessEndContour);
-    LOAD_FUNCPTR(gluTessEndPolygon);
-    LOAD_FUNCPTR(gluTessVertex);
-#undef LOAD_FUNCPTR
-    return module;
-}
-
-static void fixed_to_double(POINTFX fixed, UINT em_size, GLdouble vertex[3])
-{
-    vertex[0] = (fixed.x.value + (GLdouble)fixed.x.fract / (1 << 16)) / em_size;  
-    vertex[1] = (fixed.y.value + (GLdouble)fixed.y.fract / (1 << 16)) / em_size;  
-    vertex[2] = 0.0;
-}
-
-static void WINAPI tess_callback_vertex(GLvoid *vertex)
-{
-    GLdouble *dbl = vertex;
-    TRACE("%f, %f, %f\n", dbl[0], dbl[1], dbl[2]);
-    glVertex3dv(vertex);
-}
-
-static void WINAPI tess_callback_begin(GLenum which)
-{
-    TRACE("%d\n", which);
-    glBegin(which);
-}
-
-static void WINAPI tess_callback_end(void)
-{
-    TRACE("\n");
-    glEnd();
-}
-
-typedef struct _bezier_vector {
-    GLdouble x;
-    GLdouble y;
-} bezier_vector;
-
-static double bezier_deviation_squared(const bezier_vector *p)
-{
-    bezier_vector deviation;
-    bezier_vector vertex;
-    bezier_vector base;
-    double base_length;
-    double dot;
-
-    vertex.x = (p[0].x + p[1].x*2 + p[2].x)/4 - p[0].x;
-    vertex.y = (p[0].y + p[1].y*2 + p[2].y)/4 - p[0].y;
-
-    base.x = p[2].x - p[0].x;
-    base.y = p[2].y - p[0].y;
-
-    base_length = sqrt(base.x*base.x + base.y*base.y);
-    base.x /= base_length;
-    base.y /= base_length;
-
-    dot = base.x*vertex.x + base.y*vertex.y;
-    dot = min(max(dot, 0.0), base_length);
-    base.x *= dot;
-    base.y *= dot;
-
-    deviation.x = vertex.x-base.x;
-    deviation.y = vertex.y-base.y;
-
-    return deviation.x*deviation.x + deviation.y*deviation.y;
-}
-
-static int bezier_approximate(const bezier_vector *p, bezier_vector *points, FLOAT deviation)
-{
-    bezier_vector first_curve[3];
-    bezier_vector second_curve[3];
-    bezier_vector vertex;
-    int total_vertices;
-
-    if(bezier_deviation_squared(p) <= deviation*deviation)
-    {
-        if(points)
-            *points = p[2];
-        return 1;
-    }
-
-    vertex.x = (p[0].x + p[1].x*2 + p[2].x)/4;
-    vertex.y = (p[0].y + p[1].y*2 + p[2].y)/4;
-
-    first_curve[0] = p[0];
-    first_curve[1].x = (p[0].x + p[1].x)/2;
-    first_curve[1].y = (p[0].y + p[1].y)/2;
-    first_curve[2] = vertex;
-
-    second_curve[0] = vertex;
-    second_curve[1].x = (p[2].x + p[1].x)/2;
-    second_curve[1].y = (p[2].y + p[1].y)/2;
-    second_curve[2] = p[2];
-
-    total_vertices = bezier_approximate(first_curve, points, deviation);
-    if(points)
-        points += total_vertices;
-    total_vertices += bezier_approximate(second_curve, points, deviation);
-    return total_vertices;
-}
-
-/***********************************************************************
- *             wglUseFontOutlines_common
- */
-static BOOL wglUseFontOutlines_common(HDC hdc,
-                                      DWORD first,
-                                      DWORD count,
-                                      DWORD listBase,
-                                      FLOAT deviation,
-                                      FLOAT extrusion,
-                                      int format,
-                                      LPGLYPHMETRICSFLOAT lpgmf,
-                                      BOOL unicode)
-{
-    UINT glyph;
-    const MAT2 identity = {{0,1},{0,0},{0,0},{0,1}};
-    GLUtesselator *tess = NULL;
-    LOGFONTW lf;
-    HFONT old_font, unscaled_font;
-    UINT em_size = 1024;
-    RECT rc;
-
-    TRACE("(%p, %d, %d, %d, %f, %f, %d, %p, %s)\n", hdc, first, count,
-          listBase, deviation, extrusion, format, lpgmf, unicode ? "W" : "A");
-
-    if(deviation <= 0.0)
-        deviation = 1.0/em_size;
-
-    if(format == WGL_FONT_POLYGONS)
-    {
-        if (!load_libglu())
-        {
-            ERR("glu32 is required for this function but isn't available\n");
-            return FALSE;
-        }
-
-        tess = pgluNewTess();
-        if(!tess) return FALSE;
-        pgluTessCallback(tess, GLU_TESS_VERTEX, (_GLUfuncptr)tess_callback_vertex);
-        pgluTessCallback(tess, GLU_TESS_BEGIN, (_GLUfuncptr)tess_callback_begin);
-        pgluTessCallback(tess, GLU_TESS_END, tess_callback_end);
-    }
-
-    GetObjectW(GetCurrentObject(hdc, OBJ_FONT), sizeof(lf), &lf);
-    rc.left = rc.right = rc.bottom = 0;
-    rc.top = em_size;
-    DPtoLP(hdc, (POINT*)&rc, 2);
-    lf.lfHeight = -abs(rc.top - rc.bottom);
-    lf.lfOrientation = lf.lfEscapement = 0;
-    unscaled_font = CreateFontIndirectW(&lf);
-    old_font = SelectObject(hdc, unscaled_font);
-
-    for (glyph = first; glyph < first + count; glyph++)
-    {
-        DWORD needed;
-        GLYPHMETRICS gm;
-        BYTE *buf;
-        TTPOLYGONHEADER *pph;
-        TTPOLYCURVE *ppc;
-        GLdouble *vertices = NULL;
-        int vertex_total = -1;
-
-        if(unicode)
-            needed = GetGlyphOutlineW(hdc, glyph, GGO_NATIVE, &gm, 0, NULL, &identity);
-        else
-            needed = GetGlyphOutlineA(hdc, glyph, GGO_NATIVE, &gm, 0, NULL, &identity);
-
-        if(needed == GDI_ERROR)
-            goto error;
-
-        buf = HeapAlloc(GetProcessHeap(), 0, needed);
-
-        if(unicode)
-            GetGlyphOutlineW(hdc, glyph, GGO_NATIVE, &gm, needed, buf, &identity);
-        else
-            GetGlyphOutlineA(hdc, glyph, GGO_NATIVE, &gm, needed, buf, &identity);
-
-        TRACE("glyph %d\n", glyph);
-
-        if(lpgmf)
-        {
-            lpgmf->gmfBlackBoxX = (float)gm.gmBlackBoxX / em_size;
-            lpgmf->gmfBlackBoxY = (float)gm.gmBlackBoxY / em_size;
-            lpgmf->gmfptGlyphOrigin.x = (float)gm.gmptGlyphOrigin.x / em_size;
-            lpgmf->gmfptGlyphOrigin.y = (float)gm.gmptGlyphOrigin.y / em_size;
-            lpgmf->gmfCellIncX = (float)gm.gmCellIncX / em_size;
-            lpgmf->gmfCellIncY = (float)gm.gmCellIncY / em_size;
-
-            TRACE("%fx%f at %f,%f inc %f,%f\n", lpgmf->gmfBlackBoxX, lpgmf->gmfBlackBoxY,
-                  lpgmf->gmfptGlyphOrigin.x, lpgmf->gmfptGlyphOrigin.y, lpgmf->gmfCellIncX, lpgmf->gmfCellIncY); 
-            lpgmf++;
-        }
-
-        glNewList(listBase++, GL_COMPILE);
-        glFrontFace(GL_CCW);
-        if(format == WGL_FONT_POLYGONS)
-        {
-            glNormal3d(0.0, 0.0, 1.0);
-            pgluTessNormal(tess, 0, 0, 1);
-            pgluTessBeginPolygon(tess, NULL);
-        }
-
-        while(!vertices)
-        {
-            if(vertex_total != -1)
-                vertices = HeapAlloc(GetProcessHeap(), 0, vertex_total * 3 * sizeof(GLdouble));
-            vertex_total = 0;
-
-            pph = (TTPOLYGONHEADER*)buf;
-            while((BYTE*)pph < buf + needed)
-            {
-                GLdouble previous[3];
-                fixed_to_double(pph->pfxStart, em_size, previous);
-
-                if(vertices)
-                    TRACE("\tstart %d, %d\n", pph->pfxStart.x.value, pph->pfxStart.y.value);
-
-                if(format == WGL_FONT_POLYGONS)
-                    pgluTessBeginContour(tess);
-                else
-                    glBegin(GL_LINE_LOOP);
-
-                if(vertices)
-                {
-                    fixed_to_double(pph->pfxStart, em_size, vertices);
-                    if(format == WGL_FONT_POLYGONS)
-                        pgluTessVertex(tess, vertices, vertices);
-                    else
-                        glVertex3d(vertices[0], vertices[1], vertices[2]);
-                    vertices += 3;
-                }
-                vertex_total++;
-
-                ppc = (TTPOLYCURVE*)((char*)pph + sizeof(*pph));
-                while((char*)ppc < (char*)pph + pph->cb)
-                {
-                    int i, j;
-                    int num;
-
-                    switch(ppc->wType) {
-                    case TT_PRIM_LINE:
-                        for(i = 0; i < ppc->cpfx; i++)
-                        {
-                            if(vertices)
-                            {
-                                TRACE("\t\tline to %d, %d\n",
-                                      ppc->apfx[i].x.value, ppc->apfx[i].y.value);
-                                fixed_to_double(ppc->apfx[i], em_size, vertices);
-                                if(format == WGL_FONT_POLYGONS)
-                                    pgluTessVertex(tess, vertices, vertices);
-                                else
-                                    glVertex3d(vertices[0], vertices[1], vertices[2]);
-                                vertices += 3;
-                            }
-                            fixed_to_double(ppc->apfx[i], em_size, previous);
-                            vertex_total++;
-                        }
-                        break;
-
-                    case TT_PRIM_QSPLINE:
-                        for(i = 0; i < ppc->cpfx-1; i++)
-                        {
-                            bezier_vector curve[3];
-                            bezier_vector *points;
-                            GLdouble curve_vertex[3];
-
-                            if(vertices)
-                                TRACE("\t\tcurve  %d,%d %d,%d\n",
-                                      ppc->apfx[i].x.value,     ppc->apfx[i].y.value,
-                                      ppc->apfx[i + 1].x.value, ppc->apfx[i + 1].y.value);
-
-                            curve[0].x = previous[0];
-                            curve[0].y = previous[1];
-                            fixed_to_double(ppc->apfx[i], em_size, curve_vertex);
-                            curve[1].x = curve_vertex[0];
-                            curve[1].y = curve_vertex[1];
-                            fixed_to_double(ppc->apfx[i + 1], em_size, curve_vertex);
-                            curve[2].x = curve_vertex[0];
-                            curve[2].y = curve_vertex[1];
-                            if(i < ppc->cpfx-2)
-                            {
-                                curve[2].x = (curve[1].x + curve[2].x)/2;
-                                curve[2].y = (curve[1].y + curve[2].y)/2;
-                            }
-                            num = bezier_approximate(curve, NULL, deviation);
-                            points = HeapAlloc(GetProcessHeap(), 0, num*sizeof(bezier_vector));
-                            num = bezier_approximate(curve, points, deviation);
-                            vertex_total += num;
-                            if(vertices)
-                            {
-                                for(j=0; j<num; j++)
-                                {
-                                    TRACE("\t\t\tvertex at %f,%f\n", points[j].x, points[j].y);
-                                    vertices[0] = points[j].x;
-                                    vertices[1] = points[j].y;
-                                    vertices[2] = 0.0;
-                                    if(format == WGL_FONT_POLYGONS)
-                                        pgluTessVertex(tess, vertices, vertices);
-                                    else
-                                        glVertex3d(vertices[0], vertices[1], vertices[2]);
-                                    vertices += 3;
-                                }
-                            }
-                            HeapFree(GetProcessHeap(), 0, points);
-                            previous[0] = curve[2].x;
-                            previous[1] = curve[2].y;
-                        }
-                        break;
-                    default:
-                        ERR("\t\tcurve type = %d\n", ppc->wType);
-                        if(format == WGL_FONT_POLYGONS)
-                            pgluTessEndContour(tess);
-                        else
-                            glEnd();
-                        goto error_in_list;
-                    }
-
-                    ppc = (TTPOLYCURVE*)((char*)ppc + sizeof(*ppc) +
-                                         (ppc->cpfx - 1) * sizeof(POINTFX));
-                }
-                if(format == WGL_FONT_POLYGONS)
-                    pgluTessEndContour(tess);
-                else
-                    glEnd();
-                pph = (TTPOLYGONHEADER*)((char*)pph + pph->cb);
-            }
-        }
-
-error_in_list:
-        if(format == WGL_FONT_POLYGONS)
-            pgluTessEndPolygon(tess);
-        glTranslated((GLdouble)gm.gmCellIncX / em_size, (GLdouble)gm.gmCellIncY / em_size, 0.0);
-        glEndList();
-        HeapFree(GetProcessHeap(), 0, buf);
-        HeapFree(GetProcessHeap(), 0, vertices);
-    }
-
- error:
-    DeleteObject(SelectObject(hdc, old_font));
-    if(format == WGL_FONT_POLYGONS)
-        pgluDeleteTess(tess);
-    return TRUE;
-
-}
-
-/***********************************************************************
- *             wglUseFontOutlinesA (OPENGL32.@)
- */
-BOOL WINAPI wglUseFontOutlinesA(HDC hdc,
-                               DWORD first,
-                               DWORD count,
-                               DWORD listBase,
-                               FLOAT deviation,
-                               FLOAT extrusion,
-                               int format,
-                               LPGLYPHMETRICSFLOAT lpgmf)
-{
-    return wglUseFontOutlines_common(hdc, first, count, listBase, deviation, extrusion, format, lpgmf, FALSE);
-}
-
-/***********************************************************************
- *             wglUseFontOutlinesW (OPENGL32.@)
- */
-BOOL WINAPI wglUseFontOutlinesW(HDC hdc,
-                               DWORD first,
-                               DWORD count,
-                               DWORD listBase,
-                               FLOAT deviation,
-                               FLOAT extrusion,
-                               int format,
-                               LPGLYPHMETRICSFLOAT lpgmf)
-{
-    return wglUseFontOutlines_common(hdc, first, count, listBase, deviation, extrusion, format, lpgmf, TRUE);
-}
\ No newline at end of file
diff --git a/dll/opengl/opengl32/gl.c b/dll/opengl/opengl32/gl.c
deleted file mode 100644 (file)
index d57caf9..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * COPYRIGHT:            See COPYING in the top level directory
- * PROJECT:              ReactOS kernel
- * FILE:                 lib/opengl32/gl.c
- * PURPOSE:              OpenGL32 lib, glXXX functions
- * PROGRAMMER:           Anich Gregor (blight)
- * UPDATE HISTORY:
- *                       Feb 2, 2004: Created
- */
-
-/* On a x86 we call the ICD functions in a special-way:
- *
- * For every glXXX function we export a glXXX entry-point which loads the
- * matching "real" function pointer from the NtCurrentTeb()->glDispatchTable
- * for gl functions in teblist.h and for others it gets the pointer from
- * NtCurrentTeb()->glTable and jmps to the address, leaving the stack alone and
- * letting the "real" function return for us.
- * Royce has implemented this in NASM =D
- *
- * On other machines we use C to forward the calls (slow...)
- */
-
-#include "opengl32.h"
-
-#if defined(_M_IX86)
-C_ASSERT(FIELD_OFFSET(TEB, glTable) == 0xbe8);
-#endif
-
-int WINAPI glEmptyFunc0( void ) { return 0; }
-int WINAPI glEmptyFunc4( long l1 ) { return 0; }
-int WINAPI glEmptyFunc8( long l1, long l2 ) { return 0; }
-int WINAPI glEmptyFunc12( long l1, long l2, long l3 ) { return 0; }
-int WINAPI glEmptyFunc16( long l1, long l2, long l3, long l4 ) { return 0; }
-int WINAPI glEmptyFunc20( long l1, long l2, long l3, long l4, long l5 )
-                          { return 0; }
-int WINAPI glEmptyFunc24( long l1, long l2, long l3, long l4, long l5,
-                          long l6 ) { return 0; }
-int WINAPI glEmptyFunc28( long l1, long l2, long l3, long l4, long l5,
-                          long l6, long l7 ) { return 0; }
-int WINAPI glEmptyFunc32( long l1, long l2, long l3, long l4, long l5,
-                          long l6, long l7, long l8 ) { return 0; }
-int WINAPI glEmptyFunc36( long l1, long l2, long l3, long l4, long l5,
-                          long l6, long l7, long l8, long l9 ) { return 0; }
-int WINAPI glEmptyFunc40( long l1, long l2, long l3, long l4, long l5,
-                          long l6, long l7, long l8, long l9, long l10 )
-                          { return 0; }
-int WINAPI glEmptyFunc44( long l1, long l2, long l3, long l4, long l5,
-                          long l6, long l7, long l8, long l9, long l10,
-                          long l11 ) { return 0; }
-int WINAPI glEmptyFunc48( long l1, long l2, long l3, long l4, long l5,
-                          long l6, long l7, long l8, long l9, long l10,
-                          long l11, long l12 ) { return 0; }
-int WINAPI glEmptyFunc52( long l1, long l2, long l3, long l4, long l5,
-                          long l6, long l7, long l8, long l9, long l10,
-                          long l11, long l12, long l13 ) { return 0; }
-int WINAPI glEmptyFunc56( long l1, long l2, long l3, long l4, long l5,
-                          long l6, long l7, long l8, long l9, long l10,
-                          long l11, long l12, long l13, long l14 )
-                          { return 0; }
-
-#if defined(_M_IX86)
-# define FOO(x) #x
-
-#ifdef __GNUC__
-# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
-__asm__(".align 4"                                    "\n\t" \
-        ".globl _"#func"@"#stack                      "\n\t" \
-        "_"#func"@"#stack":"                          "\n\t" \
-        "       movl %fs:0x18, %eax"                  "\n\t" \
-        "       movl 0xbe8(%eax), %eax"               "\n\t" \
-        "       jmp *"FOO((icdidx*4))"(%eax)"         "\n\t");
-#elif defined(_MSC_VER)
-# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
-__declspec(naked) ret WINAPI func typeargs                   \
-{                                                            \
-       __asm { mov eax, dword ptr fs:[18h] };                   \
-       __asm { mov eax, dword ptr [eax+0be8h] };                \
-       __asm { jmp dword ptr [eax+icdidx*4] };                  \
-}
-#else
-# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
-ret WINAPI func typeargs                                     \
-{                                                            \
-    PROC *table;                                             \
-    PROC fn;                                                 \
-    if (tebidx >= 0 && 0)                                    \
-    {                                                        \
-        table = (PROC *)NtCurrentTeb()->glDispatchTable;     \
-        fn = table[tebidx];                                  \
-    }                                                        \
-    else                                                     \
-    {                                                        \
-        table = (PROC *)NtCurrentTeb()->glTable;             \
-        fn = table[icdidx];                                  \
-    }                                                        \
-    return (ret)((ret(*)typeargs)fn)args;                    \
-}
-#endif
-
-GLFUNCS_MACRO
-# undef FOO
-# undef X
-#else /* defined(_M_IX86) */
-# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
-ret WINAPI func typeargs                                     \
-{                                                            \
-    PROC *table;                                             \
-    PROC fn;                                                 \
-    if (tebidx >= 0 && 0)                                    \
-    {                                                        \
-        table = (PROC *)NtCurrentTeb()->glDispatchTable;     \
-        fn = table[tebidx];                                  \
-    }                                                        \
-    else                                                     \
-    {                                                        \
-        table = (PROC *)NtCurrentTeb()->glTable;             \
-        fn = table[icdidx];                                  \
-    }                                                        \
-    return (ret)((ret(*)typeargs)fn)args;                    \
-}
-
-GLFUNCS_MACRO
-
-# undef X
-#endif /* !defined(_M_IX86) */
-
-/* Unknown debugging function */
-GLint WINAPI glDebugEntry( GLint unknown1, GLint unknown2 )
-{
-    return 0;
-}
-
-
-/* EOF */
diff --git a/dll/opengl/opengl32/icdlist.h b/dll/opengl/opengl32/icdlist.h
deleted file mode 100644 (file)
index acf2e5d..0000000
+++ /dev/null
@@ -1,336 +0,0 @@
-ICD_ENTRY(glNewList)                           //0
-ICD_ENTRY(glEndList)                           //1
-ICD_ENTRY(glCallList)                          //2
-ICD_ENTRY(glCallLists)                         //3
-ICD_ENTRY(glDeleteLists)                       //4
-ICD_ENTRY(glGenLists)                          //5
-ICD_ENTRY(glListBase)                          //6
-ICD_ENTRY(glBegin)                                     //7
-ICD_ENTRY(glBitmap)                                    //8
-ICD_ENTRY(glColor3b)                           //9
-ICD_ENTRY(glColor3bv)                          //10
-ICD_ENTRY(glColor3d)                           //11
-ICD_ENTRY(glColor3dv)                          //12
-ICD_ENTRY(glColor3f)                           //13
-ICD_ENTRY(glColor3fv)                          //14
-ICD_ENTRY(glColor3i)                           //15
-ICD_ENTRY(glColor3iv)                          //16
-ICD_ENTRY(glColor3s)                           //17
-ICD_ENTRY(glColor3sv)                          //18
-ICD_ENTRY(glColor3ub)                          //19
-ICD_ENTRY(glColor3ubv)                         //20
-ICD_ENTRY(glColor3ui)                          //21
-ICD_ENTRY(glColor3uiv)                         //22
-ICD_ENTRY(glColor3us)                          //23
-ICD_ENTRY(glColor3usv)                         //24
-ICD_ENTRY(glColor4b)                           //25
-ICD_ENTRY(glColor4bv)                          //26
-ICD_ENTRY(glColor4d)                           //27
-ICD_ENTRY(glColor4dv)                          //28
-ICD_ENTRY(glColor4f)                           //29
-ICD_ENTRY(glColor4fv)                          //30
-ICD_ENTRY(glColor4i)                           //31
-ICD_ENTRY(glColor4iv)                          //32
-ICD_ENTRY(glColor4s)                           //33
-ICD_ENTRY(glColor4sv)                          //34
-ICD_ENTRY(glColor4ub)                          //35
-ICD_ENTRY(glColor4ubv)                         //36
-ICD_ENTRY(glColor4ui)                          //37
-ICD_ENTRY(glColor4uiv)                         //38
-ICD_ENTRY(glColor4us)                          //39
-ICD_ENTRY(glColor4usv)                         //40
-ICD_ENTRY(glEdgeFlag)                          //41
-ICD_ENTRY(glEdgeFlagv)                         //42
-ICD_ENTRY(glEnd)                                       //43
-ICD_ENTRY(glIndexd)                                    //44
-ICD_ENTRY(glIndexdv)                           //45
-ICD_ENTRY(glIndexf)                                    //46
-ICD_ENTRY(glIndexfv)                           //47
-ICD_ENTRY(glIndexi)                                    //48
-ICD_ENTRY(glIndexiv)                           //49
-ICD_ENTRY(glIndexs)                                    //50
-ICD_ENTRY(glIndexsv)                           //51
-ICD_ENTRY(glNormal3b)                          //52
-ICD_ENTRY(glNormal3bv)                         //53
-ICD_ENTRY(glNormal3d)                          //54
-ICD_ENTRY(glNormal3dv)                         //55
-ICD_ENTRY(glNormal3f)                          //56
-ICD_ENTRY(glNormal3fv)                         //57
-ICD_ENTRY(glNormal3i)                          //58
-ICD_ENTRY(glNormal3iv)                         //59
-ICD_ENTRY(glNormal3s)                          //60
-ICD_ENTRY(glNormal3sv)                         //61
-ICD_ENTRY(glRasterPos2d)                       //62
-ICD_ENTRY(glRasterPos2dv)                      //63
-ICD_ENTRY(glRasterPos2f)                       //64
-ICD_ENTRY(glRasterPos2fv)                      //65
-ICD_ENTRY(glRasterPos2i)                       //66
-ICD_ENTRY(glRasterPos2iv)                      //67
-ICD_ENTRY(glRasterPos2s)                       //68
-ICD_ENTRY(glRasterPos2sv)                      //69
-ICD_ENTRY(glRasterPos3d)                       //70
-ICD_ENTRY(glRasterPos3dv)                      //71
-ICD_ENTRY(glRasterPos3f)                       //72
-ICD_ENTRY(glRasterPos3fv)                      //73
-ICD_ENTRY(glRasterPos3i)                       //74
-ICD_ENTRY(glRasterPos3iv)                      //75
-ICD_ENTRY(glRasterPos3s)                       //76
-ICD_ENTRY(glRasterPos3sv)                      //77
-ICD_ENTRY(glRasterPos4d)                       //78
-ICD_ENTRY(glRasterPos4dv)                      //79
-ICD_ENTRY(glRasterPos4f)                       //80
-ICD_ENTRY(glRasterPos4fv)                      //81
-ICD_ENTRY(glRasterPos4i)                       //82
-ICD_ENTRY(glRasterPos4iv)                      //83
-ICD_ENTRY(glRasterPos4s)                       //84
-ICD_ENTRY(glRasterPos4sv)                      //85
-ICD_ENTRY(glRectd)                                     //86
-ICD_ENTRY(glRectdv)                                    //87
-ICD_ENTRY(glRectf)                                     //88
-ICD_ENTRY(glRectfv)                                    //89
-ICD_ENTRY(glRecti)                                     //90
-ICD_ENTRY(glRectiv)                                    //91
-ICD_ENTRY(glRects)                                     //92
-ICD_ENTRY(glRectsv)                                    //93
-ICD_ENTRY(glTexCoord1d)                                //94
-ICD_ENTRY(glTexCoord1dv)                       //95
-ICD_ENTRY(glTexCoord1f)                                //96
-ICD_ENTRY(glTexCoord1fv)                       //97
-ICD_ENTRY(glTexCoord1i)                                //98
-ICD_ENTRY(glTexCoord1iv)                       //99
-ICD_ENTRY(glTexCoord1s)                                //100
-ICD_ENTRY(glTexCoord1sv)                       //101
-ICD_ENTRY(glTexCoord2d)                                //102
-ICD_ENTRY(glTexCoord2dv)                       //103
-ICD_ENTRY(glTexCoord2f)                                //104
-ICD_ENTRY(glTexCoord2fv)                       //105
-ICD_ENTRY(glTexCoord2i)                                //106
-ICD_ENTRY(glTexCoord2iv)                       //107
-ICD_ENTRY(glTexCoord2s)                                //108
-ICD_ENTRY(glTexCoord2sv)                       //109
-ICD_ENTRY(glTexCoord3d)                                //110
-ICD_ENTRY(glTexCoord3dv)                       //111
-ICD_ENTRY(glTexCoord3f)                                //112
-ICD_ENTRY(glTexCoord3fv)                       //113
-ICD_ENTRY(glTexCoord3i)                                //114
-ICD_ENTRY(glTexCoord3iv)                       //115
-ICD_ENTRY(glTexCoord3s)                                //116
-ICD_ENTRY(glTexCoord3sv)                       //117
-ICD_ENTRY(glTexCoord4d)                                //118
-ICD_ENTRY(glTexCoord4dv)                       //119
-ICD_ENTRY(glTexCoord4f)                                //120
-ICD_ENTRY(glTexCoord4fv)                       //121
-ICD_ENTRY(glTexCoord4i)                                //122
-ICD_ENTRY(glTexCoord4iv)                       //123
-ICD_ENTRY(glTexCoord4s)                                //124
-ICD_ENTRY(glTexCoord4sv)                       //125
-ICD_ENTRY(glVertex2d)                          //126
-ICD_ENTRY(glVertex2dv)                         //127
-ICD_ENTRY(glVertex2f)                          //128
-ICD_ENTRY(glVertex2fv)                         //129
-ICD_ENTRY(glVertex2i)                          //130
-ICD_ENTRY(glVertex2iv)                         //131
-ICD_ENTRY(glVertex2s)                          //132
-ICD_ENTRY(glVertex2sv)                         //133
-ICD_ENTRY(glVertex3d)                          //134
-ICD_ENTRY(glVertex3dv)                         //135
-ICD_ENTRY(glVertex3f)                          //136
-ICD_ENTRY(glVertex3fv)                         //137
-ICD_ENTRY(glVertex3i)                          //138
-ICD_ENTRY(glVertex3iv)                         //139
-ICD_ENTRY(glVertex3s)                          //140
-ICD_ENTRY(glVertex3sv)                         //141
-ICD_ENTRY(glVertex4d)                          //142
-ICD_ENTRY(glVertex4dv)                         //143
-ICD_ENTRY(glVertex4f)                          //144
-ICD_ENTRY(glVertex4fv)                         //145
-ICD_ENTRY(glVertex4i)                          //146
-ICD_ENTRY(glVertex4iv)                         //147
-ICD_ENTRY(glVertex4s)                          //148
-ICD_ENTRY(glVertex4sv)                         //149
-ICD_ENTRY(glClipPlane)                         //150
-ICD_ENTRY(glColorMaterial)                     //151
-ICD_ENTRY(glCullFace)                          //152
-ICD_ENTRY(glFogf)                                      //153
-ICD_ENTRY(glFogfv)                                     //154
-ICD_ENTRY(glFogi)                                      //155
-ICD_ENTRY(glFogiv)                                     //156
-ICD_ENTRY(glFrontFace)                         //157
-ICD_ENTRY(glHint)                                      //158
-ICD_ENTRY(glLightf)                                    //159
-ICD_ENTRY(glLightfv)                           //160
-ICD_ENTRY(glLighti)                                    //161
-ICD_ENTRY(glLightiv)                           //162
-ICD_ENTRY(glLightModelf)                       //163
-ICD_ENTRY(glLightModelfv)                      //164
-ICD_ENTRY(glLightModeli)                       //165
-ICD_ENTRY(glLightModeliv)                      //166
-ICD_ENTRY(glLineStipple)                       //167
-ICD_ENTRY(glLineWidth)                         //168
-ICD_ENTRY(glMaterialf)                         //169
-ICD_ENTRY(glMaterialfv)                                //170
-ICD_ENTRY(glMateriali)                         //171
-ICD_ENTRY(glMaterialiv)                                //172
-ICD_ENTRY(glPointSize)                         //173
-ICD_ENTRY(glPolygonMode)                       //174
-ICD_ENTRY(glPolygonStipple)                    //175
-ICD_ENTRY(glScissor)                           //176
-ICD_ENTRY(glShadeModel)                                //177
-ICD_ENTRY(glTexParameterf)                     //178
-ICD_ENTRY(glTexParameterfv)                    //179
-ICD_ENTRY(glTexParameteri)                     //180
-ICD_ENTRY(glTexParameteriv)                    //181
-ICD_ENTRY(glTexImage1D)                                //182
-ICD_ENTRY(glTexImage2D)                                //183
-ICD_ENTRY(glTexEnvf)                           //184
-ICD_ENTRY(glTexEnvfv)                          //185
-ICD_ENTRY(glTexEnvi)                           //186
-ICD_ENTRY(glTexEnviv)                          //187
-ICD_ENTRY(glTexGend)                           //188
-ICD_ENTRY(glTexGendv)                          //189
-ICD_ENTRY(glTexGenf)                           //190
-ICD_ENTRY(glTexGenfv)                          //191
-ICD_ENTRY(glTexGeni)                           //192
-ICD_ENTRY(glTexGeniv)                          //193
-ICD_ENTRY(glFeedbackBuffer)                    //194
-ICD_ENTRY(glSelectBuffer)                      //195
-ICD_ENTRY(glRenderMode)                                //196
-ICD_ENTRY(glInitNames)                         //197
-ICD_ENTRY(glLoadName)                          //198
-ICD_ENTRY(glPassThrough)                       //199
-ICD_ENTRY(glPopName)                           //200
-ICD_ENTRY(glPushName)                          //201
-ICD_ENTRY(glDrawBuffer)                                //202
-ICD_ENTRY(glClear)                                     //203
-ICD_ENTRY(glClearAccum)                                //204
-ICD_ENTRY(glClearIndex)                                //205
-ICD_ENTRY(glClearColor)                                //206
-ICD_ENTRY(glClearStencil)                      //207
-ICD_ENTRY(glClearDepth)                                //208
-ICD_ENTRY(glStencilMask)                       //209
-ICD_ENTRY(glColorMask)                         //210
-ICD_ENTRY(glDepthMask)                         //211
-ICD_ENTRY(glIndexMask)                         //212
-ICD_ENTRY(glAccum)                                     //213
-ICD_ENTRY(glDisable)                           //214
-ICD_ENTRY(glEnable)                                    //215
-ICD_ENTRY(glFinish)                                    //216
-ICD_ENTRY(glFlush)                                     //217
-ICD_ENTRY(glPopAttrib)                         //218
-ICD_ENTRY(glPushAttrib)                                //219
-ICD_ENTRY(glMap1d)                                     //220
-ICD_ENTRY(glMap1f)                                     //221
-ICD_ENTRY(glMap2d)                                     //222
-ICD_ENTRY(glMap2f)                                     //223
-ICD_ENTRY(glMapGrid1d)                         //224
-ICD_ENTRY(glMapGrid1f)                         //225
-ICD_ENTRY(glMapGrid2d)                         //226
-ICD_ENTRY(glMapGrid2f)                         //227
-ICD_ENTRY(glEvalCoord1d)                       //228
-ICD_ENTRY(glEvalCoord1dv)                      //229
-ICD_ENTRY(glEvalCoord1f)                       //230
-ICD_ENTRY(glEvalCoord1fv)                      //231
-ICD_ENTRY(glEvalCoord2d)                       //232
-ICD_ENTRY(glEvalCoord2dv)                      //233
-ICD_ENTRY(glEvalCoord2f)                       //234
-ICD_ENTRY(glEvalCoord2fv)                      //235
-ICD_ENTRY(glEvalMesh1)                         //236
-ICD_ENTRY(glEvalPoint1)                                //237
-ICD_ENTRY(glEvalMesh2)                         //238
-ICD_ENTRY(glEvalPoint2)                                //239
-ICD_ENTRY(glAlphaFunc)                         //240
-ICD_ENTRY(glBlendFunc)                         //241
-ICD_ENTRY(glLogicOp)                           //242
-ICD_ENTRY(glStencilFunc)                       //243
-ICD_ENTRY(glStencilOp)                         //244
-ICD_ENTRY(glDepthFunc)                         //245
-ICD_ENTRY(glPixelZoom)                         //246
-ICD_ENTRY(glPixelTransferf)                    //247
-ICD_ENTRY(glPixelTransferi)                    //248
-ICD_ENTRY(glPixelStoref)                       //249
-ICD_ENTRY(glPixelStorei)                       //250
-ICD_ENTRY(glPixelMapfv)                                //251
-ICD_ENTRY(glPixelMapuiv)                       //252
-ICD_ENTRY(glPixelMapusv)                       //253
-ICD_ENTRY(glReadBuffer)                                //254
-ICD_ENTRY(glCopyPixels)                                //255
-ICD_ENTRY(glReadPixels)                                //256
-ICD_ENTRY(glDrawPixels)                                //257
-ICD_ENTRY(glGetBooleanv)                       //258
-ICD_ENTRY(glGetClipPlane)                      //259
-ICD_ENTRY(glGetDoublev)                                //260
-ICD_ENTRY(glGetError)                          //261
-ICD_ENTRY(glGetFloatv)                         //262
-ICD_ENTRY(glGetIntegerv)                       //263
-ICD_ENTRY(glGetLightfv)                                //264
-ICD_ENTRY(glGetLightiv)                                //265
-ICD_ENTRY(glGetMapdv)                          //266
-ICD_ENTRY(glGetMapfv)                          //267
-ICD_ENTRY(glGetMapiv)                          //268
-ICD_ENTRY(glGetMaterialfv)                     //269
-ICD_ENTRY(glGetMaterialiv)                     //270
-ICD_ENTRY(glGetPixelMapfv)                     //271
-ICD_ENTRY(glGetPixelMapuiv)                    //272
-ICD_ENTRY(glGetPixelMapusv)                    //273
-ICD_ENTRY(glGetPolygonStipple)         //274
-ICD_ENTRY(glGetString)                         //275
-ICD_ENTRY(glGetTexEnvfv)                       //276
-ICD_ENTRY(glGetTexEnviv)                       //277
-ICD_ENTRY(glGetTexGendv)                       //278
-ICD_ENTRY(glGetTexGenfv)                       //279
-ICD_ENTRY(glGetTexGeniv)                       //280
-ICD_ENTRY(glGetTexImage)                       //281
-ICD_ENTRY(glGetTexParameterfv)         //282
-ICD_ENTRY(glGetTexParameteriv)         //283
-ICD_ENTRY(glGetTexLevelParameterfv)    //284
-ICD_ENTRY(glGetTexLevelParameteriv)    //285
-ICD_ENTRY(glIsEnabled)                         //286
-ICD_ENTRY(glIsList)                                    //287
-ICD_ENTRY(glDepthRange)                                //288
-ICD_ENTRY(glFrustum)                           //289
-ICD_ENTRY(glLoadIdentity)                      //290
-ICD_ENTRY(glLoadMatrixf)                       //291
-ICD_ENTRY(glLoadMatrixd)                       //292
-ICD_ENTRY(glMatrixMode)                                //293
-ICD_ENTRY(glMultMatrixf)                       //294
-ICD_ENTRY(glMultMatrixd)                       //295
-ICD_ENTRY(glOrtho)                                     //296
-ICD_ENTRY(glPopMatrix)                         //297
-ICD_ENTRY(glPushMatrix)                                //298
-ICD_ENTRY(glRotated)                           //299
-ICD_ENTRY(glRotatef)                           //300
-ICD_ENTRY(glScaled)                                    //301
-ICD_ENTRY(glScalef)                                    //302
-ICD_ENTRY(glTranslated)                                //303
-ICD_ENTRY(glTranslatef)                                //304
-ICD_ENTRY(glViewport)                          //305
-ICD_ENTRY(glArrayElement)                      //306
-ICD_ENTRY(glBindTexture)                       //307
-ICD_ENTRY(glColorPointer)                      //308
-ICD_ENTRY(glDisableClientState)                //309
-ICD_ENTRY(glDrawArrays)                                //310
-ICD_ENTRY(glDrawElements)                      //311
-ICD_ENTRY(glEdgeFlagPointer)           //312
-ICD_ENTRY(glEnableClientState)         //313
-ICD_ENTRY(glIndexPointer)                      //314
-ICD_ENTRY(glIndexub)                           //315
-ICD_ENTRY(glIndexubv)                          //316
-ICD_ENTRY(glInterleavedArrays)         //317
-ICD_ENTRY(glNormalPointer)                     //318
-ICD_ENTRY(glPolygonOffset)                     //319
-ICD_ENTRY(glTexCoordPointer)           //320
-ICD_ENTRY(glVertexPointer)                     //321
-ICD_ENTRY(glAreTexturesResident)       //322
-ICD_ENTRY(glCopyTexImage1D)                    //323
-ICD_ENTRY(glCopyTexImage2D)                    //324
-ICD_ENTRY(glCopyTexSubImage1D)         //325
-ICD_ENTRY(glCopyTexSubImage2D)         //326
-ICD_ENTRY(glDeleteTextures)                    //327
-ICD_ENTRY(glGenTextures)                       //328
-ICD_ENTRY(glGetPointerv)                       //329
-ICD_ENTRY(glIsTexture)                         //330
-ICD_ENTRY(glPrioritizeTextures)                //331
-ICD_ENTRY(glTexSubImage1D)                     //332
-ICD_ENTRY(glTexSubImage2D)                     //333
-ICD_ENTRY(glPopClientAttrib)           //334
-ICD_ENTRY(glPushClientAttrib)          //335
diff --git a/dll/opengl/opengl32/icdtable.h b/dll/opengl/opengl32/icdtable.h
deleted file mode 100644 (file)
index 2619f34..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* icdtable.h */
-
-#ifndef OPENGL32_PRIVATE_ICDTABLE_H
-#define OPENGL32_PRIVATE_ICDTABLE_H
-
-enum icdoffsets_e
-{
-    ICDIDX_INVALID = -1,
-#define ICD_ENTRY(x) ICDIDX_##x,
-#include "icdlist.h"
-#undef ICD_ENTRY
-    ICDIDX_COUNT
-};
-
-typedef struct tagICDTable
-{
-    DWORD      num_funcs;           /*!< Normally 336 (0x150) -- the number of functions in OpenGL 1.1 */
-    PROC       dispatch_table[812]; /*!< Table containing \a num_funcs pointers to OpenGL functions */
-} ICDTable, *PICDTable;
-
-#define DISPATCH_TABLE_SIZE 812*sizeof(PROC)
-
-#endif /* OPENGL32_PRIVATE_ICDTABLE_H */
-
-/* EOF */
diff --git a/dll/opengl/opengl32/opengl32.c b/dll/opengl/opengl32/opengl32.c
deleted file mode 100644 (file)
index 0bf4856..0000000
+++ /dev/null
@@ -1,625 +0,0 @@
-/*
- * COPYRIGHT:            See COPYING in the top level directory
- * PROJECT:              ReactOS kernel
- * FILE:                 lib/opengl32/opengl32.c
- * PURPOSE:              OpenGL32 lib
- * PROGRAMMER:           Anich Gregor (blight), Royce Mitchell III
- * UPDATE HISTORY:
- *                       Feb 1, 2004: Created
- */
-
-#include "opengl32.h"
-
-/* function prototypes */
-static void OPENGL32_AppendICD( GLDRIVERDATA *icd );
-static void OPENGL32_RemoveICD( GLDRIVERDATA *icd );
-static GLDRIVERDATA *OPENGL32_LoadDriver( LPCWSTR regKey );
-static DWORD OPENGL32_InitializeDriver( GLDRIVERDATA *icd );
-static BOOL OPENGL32_UnloadDriver( GLDRIVERDATA *icd );
-static DWORD OPENGL32_RegGetDriverInfo( LPCWSTR driver, GLDRIVERDATA *icd );
-
-
-/* global vars */
-GLPROCESSDATA OPENGL32_processdata;
-
-
-static BOOL
-OPENGL32_ThreadAttach( void )
-{
-    PROC *dispatchTable = NULL;
-    TEB *teb = NULL;
-
-    dispatchTable = (PROC*)HeapAlloc( GetProcessHeap(),
-                                      HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY,
-                                      DISPATCH_TABLE_SIZE );
-    if (dispatchTable == NULL)
-    {
-        DBGPRINT( "Error: Couldn't allocate GL dispatch table" );
-        return FALSE;
-    }
-
-    teb = NtCurrentTeb();
-
-    /* initialize dispatch table with empty functions */
-    #define X(func, ret, typeargs, args, icdidx, tebidx, stack)            \
-        dispatchTable[icdidx] = (PROC)glEmptyFunc##stack;                  \
-        if (tebidx >= 0)                                                   \
-            teb->glDispatchTable[tebidx] = (PVOID)glEmptyFunc##stack;
-    GLFUNCS_MACRO
-    #undef X
-
-    teb->glTable = dispatchTable;
-    /* At first we have no context */
-    teb->glCurrentRC = NULL;
-
-    return TRUE;
-}
-
-
-static void
-OPENGL32_ThreadDetach( void )
-{
-       TEB* teb = NtCurrentTeb();
-
-    rosglMakeCurrent( NULL, NULL );
-
-    if (teb->glTable != NULL)
-    {
-        if (!HeapFree( GetProcessHeap(), 0, teb->glTable ))
-               {
-            DBGPRINT( "Warning: HeapFree() on dispatch table failed (%d)",
-                      GetLastError() );
-               }
-               /* NULL-ify it. Even if something went wrong, it's not a good idea to keep it non NULL */
-               teb->glTable = NULL;
-    }
-}
-
-
-static BOOL
-OPENGL32_ProcessAttach( void )
-{
-    SECURITY_ATTRIBUTES attrib = { sizeof (SECURITY_ATTRIBUTES), /* nLength */
-                                   NULL, /* lpSecurityDescriptor */
-                                   TRUE /* bInheritHandle */ };
-
-    memset( &OPENGL32_processdata, 0, sizeof (OPENGL32_processdata) );
-
-    /* create driver, glrc & dcdata list mutex */
-    OPENGL32_processdata.driver_mutex = CreateMutex( &attrib, FALSE, NULL );
-    if (OPENGL32_processdata.driver_mutex == NULL)
-    {
-        DBGPRINT( "Error: Couldn't create driver_list mutex (%d)",
-                  GetLastError() );
-        return FALSE;
-    }
-    OPENGL32_processdata.glrc_mutex = CreateMutex( &attrib, FALSE, NULL );
-    if (OPENGL32_processdata.glrc_mutex == NULL)
-    {
-        DBGPRINT( "Error: Couldn't create glrc_list mutex (%d)",
-                  GetLastError() );
-        return FALSE;
-    }
-    OPENGL32_processdata.dcdata_mutex = CreateMutex( &attrib, FALSE, NULL );
-    if (OPENGL32_processdata.dcdata_mutex == NULL)
-    {
-        DBGPRINT( "Error: Couldn't create dcdata_list mutex (%d)",
-                  GetLastError() );
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
-
-static void
-OPENGL32_ProcessDetach( void )
-{
-    GLDRIVERDATA *icd, *icd2;
-    GLDCDATA *dcdata, *dcdata2;
-    GLRC *glrc, *glrc2;
-
-    /* free lists */
-    for (dcdata = OPENGL32_processdata.dcdata_list; dcdata != NULL;)
-    {
-        dcdata2 = dcdata;
-        dcdata = dcdata->next;
-        if (!HeapFree( GetProcessHeap(), 0, dcdata2 ))
-            DBGPRINT( "Warning: HeapFree() on DCDATA 0x%08x failed (%d)",
-                      dcdata2, GetLastError() );
-    }
-
-    for (glrc = OPENGL32_processdata.glrc_list; glrc != NULL;)
-    {
-        glrc2 = glrc;
-        glrc = glrc->next;
-        if (!HeapFree( GetProcessHeap(), 0, glrc2 ))
-            DBGPRINT( "Warning: HeapFree() on GLRC 0x%08x failed (%d)",
-                      glrc2, GetLastError() );
-    }
-
-    for (icd = OPENGL32_processdata.driver_list; icd != NULL;)
-    {
-        icd2 = icd;
-        icd = icd->next;
-        if (!HeapFree( GetProcessHeap(), 0, icd2 ))
-            DBGPRINT( "Warning: HeapFree() on DRIVERDATA 0x%08x failed (%d)",
-                      icd2, GetLastError() );
-    }
-
-    /* free mutexes */
-    if (OPENGL32_processdata.driver_mutex != NULL)
-        CloseHandle( OPENGL32_processdata.driver_mutex );
-    if (OPENGL32_processdata.glrc_mutex != NULL)
-        CloseHandle( OPENGL32_processdata.glrc_mutex );
-    if (OPENGL32_processdata.dcdata_mutex != NULL)
-        CloseHandle( OPENGL32_processdata.dcdata_mutex );
-}
-
-
-BOOL WINAPI
-DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
-{
-    DBGPRINT( "Info: Called!" );
-    switch ( Reason )
-    {
-    /* The DLL is loading due to process
-     * initialization or a call to LoadLibrary.
-     */
-    case DLL_PROCESS_ATTACH:
-        DBGTRACE( "Process attach" );
-        if (!OPENGL32_ProcessAttach())
-            return FALSE;
-        /* No break: Initialize the index for first thread. */
-
-    /* The attached process creates a new thread. */
-    case DLL_THREAD_ATTACH:
-        DBGTRACE( "Thread attach" );
-        if (!OPENGL32_ThreadAttach())
-            return FALSE;
-        break;
-
-    /* The thread of the attached process terminates. */
-    case DLL_THREAD_DETACH:
-        DBGTRACE( "Thread detach" );
-        /* Release the allocated memory for this thread.*/
-        OPENGL32_ThreadDetach();
-        break;
-
-    /* DLL unload due to process termination or FreeLibrary. */
-    case DLL_PROCESS_DETACH:
-        DBGTRACE( "Process detach" );
-        OPENGL32_ThreadDetach();
-        OPENGL32_ProcessDetach();
-        break;
-    }
-
-    return TRUE;
-}
-
-
-/*! \brief Append ICD to linked list.
- *
- * \param icd  GLDRIVERDATA to append to list
- *
- * \note Only call this when you hold the driver_mutex.
- */
-static void
-OPENGL32_AppendICD( GLDRIVERDATA *icd )
-{
-    if (OPENGL32_processdata.driver_list == NULL)
-        OPENGL32_processdata.driver_list = icd;
-    else
-    {
-        GLDRIVERDATA *p = OPENGL32_processdata.driver_list;
-        while (p->next != NULL)
-            p = p->next;
-        p->next = icd;
-    }
-}
-
-
-/*! \brief Remove ICD from linked list.
- *
- * \param icd  GLDRIVERDATA to remove from list
- *
- * \note Only call this when you hold the driver_mutex.
- */
-static void
-OPENGL32_RemoveICD( GLDRIVERDATA *icd )
-{
-    if (icd == OPENGL32_processdata.driver_list)
-        OPENGL32_processdata.driver_list = icd->next;
-    else
-    {
-        GLDRIVERDATA *p = OPENGL32_processdata.driver_list;
-        while (p != NULL)
-        {
-            if (p->next == icd)
-            {
-                p->next = icd->next;
-                return;
-            }
-            p = p->next;
-        }
-        DBGPRINT( "Error: ICD 0x%08x not found in list!", icd );
-    }
-}
-
-
-/*! \brief  Load an ICD.
- *
- * \param driver  Name of installable client driver.
- *
- * \return Pointer to an allocated GLDRIVERDATA struct.
- * \retval NULL  Failure.
- *
- * \todo Call SetLastError() where appropriate.
- */
-static GLDRIVERDATA *
-OPENGL32_LoadDriver( LPCWSTR driver )
-{
-    LONG ret;
-    GLDRIVERDATA *icd;
-
-    DBGPRINT( "Info: Loading driver %ws...", driver );
-
-    /* allocate driver data */
-    icd = (GLDRIVERDATA*)HeapAlloc( GetProcessHeap(),
-                                    HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY,
-                                    sizeof (GLDRIVERDATA) );
-    if (icd == NULL)
-    {
-        DBGPRINT( "Error: Couldn't allocate GLDRIVERDATA! (%d)", GetLastError() );
-        return NULL;
-    }
-
-    ret = OPENGL32_RegGetDriverInfo( driver, icd );
-    if (ret != ERROR_SUCCESS)
-    {
-        DBGPRINT( "Error: Couldn't query driver information (%d)", ret );
-        if (!HeapFree( GetProcessHeap(), 0, icd ))
-            DBGPRINT( "Error: HeapFree() returned false, error code = %d",
-                      GetLastError() );
-        return NULL;
-    }
-
-    DBGPRINT( "Info: Dll = %ws", icd->dll );
-    DBGPRINT( "Info: Version = 0x%08x", icd->version );
-    DBGPRINT( "Info: DriverVersion = 0x%08x", icd->driver_version );
-    DBGPRINT( "Info: Flags = 0x%08x", icd->flags );
-
-    /* load/initialize ICD */
-    ret = OPENGL32_InitializeDriver( icd );
-    if (ret != ERROR_SUCCESS)
-    {
-        DBGPRINT( "Error: Couldnt initialize ICD!" );
-        if (!HeapFree( GetProcessHeap(), 0, icd ))
-            DBGPRINT( "Error: HeapFree() returned false, error code = %d",
-                      GetLastError() );
-        return NULL;
-    }
-
-    /* append ICD to list */
-    OPENGL32_AppendICD( icd );
-    DBGPRINT( "Info: ICD loaded." );
-
-    return icd;
-}
-
-
-/*! \brief Initialize a driver (Load DLL and DrvXxx procs)
- *
- * \param icd  ICD to initialize with the dll, version, driverVersion
- *             and flags already filled.
- * \return Error code.
- * \retval ERROR_SUCCESS  Success
- */
-#define LOAD_DRV_PROC( icd, proc, required ) \
-    *(char**)&icd->proc = (char*)GetProcAddress( icd->handle, #proc ); \
-    if (required && icd->proc == NULL) { \
-        DBGPRINT( "Error: GetProcAddress(\"%s\") failed!", #proc ); \
-        FreeLibrary( icd->handle ); \
-        return GetLastError(); \
-    }
-
-static DWORD
-OPENGL32_InitializeDriver( GLDRIVERDATA *icd )
-{
-    /* check version */
-    if (icd->version > 2)
-        DBGPRINT( "Warning: ICD version > 2 (%d)", icd->version );
-
-    /* load dll */
-    icd->handle = LoadLibraryW( icd->dll );
-    if (icd->handle == NULL)
-    {
-        DWORD err = GetLastError();
-        DBGPRINT( "Error: Couldn't load DLL! (%d)", err );
-        return err;
-    }
-
-    /* validate version */
-    if (icd->driver_version > 1)
-    {
-        LOAD_DRV_PROC(icd, DrvValidateVersion, FALSE);
-        if (icd->DrvValidateVersion != NULL)
-        {
-            if (!icd->DrvValidateVersion( icd->driver_version ))
-            {
-                DBGPRINT( "Error: DrvValidateVersion failed!" );
-                DBGBREAK();
-                FreeLibrary( icd->handle );
-                return ERROR_INVALID_FUNCTION; /* FIXME: use better error code */
-            }
-        }
-        else
-            DBGPRINT( "Info: DrvValidateVersion not exported by ICD" );
-    }
-
-    /* load DrvXXX procs */
-    LOAD_DRV_PROC(icd, DrvCopyContext, TRUE);
-    LOAD_DRV_PROC(icd, DrvCreateContext, FALSE);
-    LOAD_DRV_PROC(icd, DrvCreateLayerContext, FALSE);
-    LOAD_DRV_PROC(icd, DrvDeleteContext, TRUE);
-    LOAD_DRV_PROC(icd, DrvDescribeLayerPlane, TRUE);
-    LOAD_DRV_PROC(icd, DrvDescribePixelFormat, TRUE);
-    LOAD_DRV_PROC(icd, DrvGetLayerPaletteEntries, TRUE);
-    LOAD_DRV_PROC(icd, DrvGetProcAddress, TRUE);
-    LOAD_DRV_PROC(icd, DrvReleaseContext, TRUE);
-    LOAD_DRV_PROC(icd, DrvRealizeLayerPalette, TRUE);
-    LOAD_DRV_PROC(icd, DrvSetContext, TRUE);
-    LOAD_DRV_PROC(icd, DrvSetLayerPaletteEntries, TRUE);
-    LOAD_DRV_PROC(icd, DrvSetPixelFormat, TRUE);
-    LOAD_DRV_PROC(icd, DrvShareLists, TRUE);
-    LOAD_DRV_PROC(icd, DrvSwapBuffers, TRUE);
-    LOAD_DRV_PROC(icd, DrvSwapLayerBuffers, TRUE);
-
-    /* we require at least one of DrvCreateContext and DrvCreateLayerContext */
-    if (icd->DrvCreateContext == NULL && icd->DrvCreateLayerContext == NULL)
-    {
-        DBGPRINT( "Error: One of DrvCreateContext/DrvCreateLayerContext is required!" );
-        FreeLibrary( icd->handle );
-        return ERROR_INVALID_FUNCTION; /* FIXME: use better error code... */
-    }
-
-    return ERROR_SUCCESS;
-}
-
-
-/*! \brief Unload ICD.
- *
- * \retval  TRUE  Success.
- * \retval  FALSE Failure.
- */
-static BOOL
-OPENGL32_UnloadDriver( GLDRIVERDATA *icd )
-{
-    BOOL allOk = TRUE;
-
-    DBGPRINT( "Info: Unloading driver %ws...", icd->driver_name );
-    if (icd->refcount != 0)
-        DBGPRINT( "Warning: ICD refcount = %d (should be 0)", icd->refcount );
-
-    /* unload dll */
-    if (!FreeLibrary( icd->handle ))
-    {
-        allOk = FALSE;
-        DBGPRINT( "Warning: FreeLibrary on ICD %ws failed! (%d)", icd->dll,
-                  GetLastError() );
-    }
-
-    /* free resources */
-    OPENGL32_RemoveICD( icd );
-    if (!HeapFree( GetProcessHeap(), 0, icd ))
-    {
-        allOk = FALSE;
-        DBGPRINT( "Warning: HeapFree() returned FALSE, error code = %d",
-                  GetLastError() );
-    }
-
-    return allOk;
-}
-
-
-/*! \brief Load ICD (shared ICD data)
- *
- * \return Pointer to an allocated GLDRIVERDATA on success.
- * \retval NULL  Failure.
- */
-GLDRIVERDATA *
-OPENGL32_LoadICD( LPCWSTR driver )
-{
-    GLDRIVERDATA *icd;
-
-    /* synchronize */
-    if (WaitForSingleObject( OPENGL32_processdata.driver_mutex, INFINITE ) ==
-        WAIT_FAILED)
-    {
-        DBGPRINT( "Error: WaitForSingleObject() failed (%d)", GetLastError() );
-        return NULL; /* FIXME: do we have to expect such an error and handle it? */
-    }
-
-    /* look if ICD is already loaded */
-    for (icd = OPENGL32_processdata.driver_list; icd; icd = icd->next)
-    {
-        if (!_wcsicmp( driver, icd->driver_name )) /* found */
-        {
-            /* release mutex */
-            if (!ReleaseMutex( OPENGL32_processdata.driver_mutex ))
-                DBGPRINT( "Error: ReleaseMutex() failed (%d)", GetLastError() );
-
-            return icd;
-        }
-    }
-
-    /* not found - try to load */
-    icd = OPENGL32_LoadDriver( driver );
-
-    /* release mutex */
-    if (!ReleaseMutex( OPENGL32_processdata.driver_mutex ))
-        DBGPRINT( "Error: ReleaseMutex() failed (%d)", GetLastError() );
-
-    return icd;
-}
-
-
-/*! \brief Unload ICD (shared ICD data)
- *
- * \retval TRUE   Success.
- * \retval FALSE  Failure.
- */
-BOOL
-OPENGL32_UnloadICD( GLDRIVERDATA *icd )
-{
-    BOOL ret = TRUE;
-
-    /* synchronize */
-    if (WaitForSingleObject( OPENGL32_processdata.driver_mutex, INFINITE ) ==
-        WAIT_FAILED)
-    {
-        DBGPRINT( "Error: WaitForSingleObject() failed (%d)", GetLastError() );
-        return FALSE; /* FIXME: do we have to expect such an error and handle it? */
-    }
-
-    if (icd->refcount == 0)
-        ret = OPENGL32_UnloadDriver( icd );
-
-    /* release mutex */
-    if (!ReleaseMutex( OPENGL32_processdata.driver_mutex ))
-        DBGPRINT( "Error: ReleaseMutex() failed (%d)", GetLastError() );
-
-    return ret;
-}
-
-
-/*! \brief Enumerate OpenGLDrivers (from registry)
- *
- * \param idx    Index of the driver to get information about.
- * \param name   Pointer to an array of WCHARs (can be NULL)
- * \param cName  Pointer to a DWORD. Input is len of name array.
- *               Output is length of the drivername.
- *               Can be NULL if name is NULL.
- *
- * \return Error code
- * \retval ERROR_NO_MORE_ITEMS  End of driver list.
- * \retval ERROR_SUCCESS        Success.
- */
-#if 0 /* unused */
-DWORD
-OPENGL32_RegEnumDrivers( DWORD idx, LPWSTR name, LPDWORD cName )
-{
-    HKEY hKey;
-    LPCWSTR subKey = OPENGL_DRIVERS_SUBKEY;
-    LONG ret;
-    DWORD size;
-    WCHAR driver[256];
-
-    if (name == NULL)
-        return ERROR_SUCCESS; /* nothing to do */
-
-    if (cName == NULL)
-        return ERROR_INVALID_FUNCTION; /* we need cName when name is given */
-
-    /* open OpenGLDrivers registry key */
-    ret = RegOpenKeyExW( HKEY_LOCAL_MACHINE, subKey, 0, KEY_READ, &hKey );
-    if (ret != ERROR_SUCCESS)
-    {
-        DBGPRINT( "Error: Couldn't open registry key '%ws'", subKey );
-        return ret;
-    }
-
-    /* get subkey name */
-    size = sizeof (driver) / sizeof (driver[0]);
-    ret = RegEnumKeyW( hKey, idx, name, *cName );
-    if (ret != ERROR_SUCCESS)
-    {
-        DBGPRINT( "Error: Couldn't get OpenGLDrivers subkey name (%d)", ret );
-        RegCloseKey( hKey );
-        return ret;
-    }
-    *cName = wcslen( name );
-
-    /* close key */
-    RegCloseKey( hKey );
-    return ERROR_SUCCESS;
-}
-#endif /* 0 -- unused */
-
-
-/*! \brief Get registry values for a driver given a name.
- *
- * \param driver  Name of the driver to get information about.
- * \param icd     Pointer to GLDRIVERDATA.
- *
- * \return Error code.
- * \retval ERROR_SUCCESS  Success.
- *
- * \note On success the following fields of \a icd are filled: \a driver_name,
- *       \a dll, \a version, \a driver_version and \a flags.
- */
-static DWORD
-OPENGL32_RegGetDriverInfo( LPCWSTR driver, GLDRIVERDATA *icd )
-{
-    HKEY hKey;
-    WCHAR subKey[1024] = OPENGL_DRIVERS_SUBKEY2;
-    LONG ret;
-    DWORD type, size;
-
-    /* drivers registry values */
-    DWORD version = 1, driverVersion = 0, flags = 0;
-    WCHAR dll[256];
-
-    /* open driver registry key */
-    wcsncat( subKey, driver, 1024 );
-    ret = RegOpenKeyExW( HKEY_LOCAL_MACHINE, subKey, 0, KEY_READ, &hKey );
-    if (ret != ERROR_SUCCESS)
-    {
-        DBGPRINT( "Error: Couldn't open registry key '%ws'", subKey );
-        return ret;
-    }
-
-    /* query values */
-    size = sizeof (dll);
-    ret = RegQueryValueExW( hKey, L"Dll", 0, &type, (LPBYTE)dll, &size );
-    if (ret != ERROR_SUCCESS || type != REG_SZ)
-    {
-        DBGPRINT( "Error: Couldn't query Dll value or not a string" );
-        RegCloseKey( hKey );
-        return ret;
-    }
-
-    size = sizeof (DWORD);
-    ret = RegQueryValueExW( hKey, L"Version", 0, &type, (LPBYTE)&version, &size );
-    if (ret != ERROR_SUCCESS || type != REG_DWORD)
-        DBGPRINT( "Warning: Couldn't query Version value or not a DWORD" );
-
-    size = sizeof (DWORD);
-    ret = RegQueryValueExW( hKey, L"DriverVersion", 0, &type,
-                            (LPBYTE)&driverVersion, &size );
-    if (ret != ERROR_SUCCESS || type != REG_DWORD)
-        DBGPRINT( "Warning: Couldn't query DriverVersion value or not a DWORD" );
-
-    size = sizeof (DWORD);
-    ret = RegQueryValueExW( hKey, L"Flags", 0, &type, (LPBYTE)&flags, &size );
-    if (ret != ERROR_SUCCESS || type != REG_DWORD)
-        DBGPRINT( "Warning: Couldn't query Flags value or not a DWORD" );
-
-    /* close key */
-    RegCloseKey( hKey );
-
-    /* output data */
-    /* FIXME: NUL-terminate strings? */
-    wcsncpy( icd->driver_name, driver,
-             sizeof (icd->driver_name) / sizeof (icd->driver_name[0]) - 1 );
-    wcsncpy( icd->dll, dll,
-             sizeof (icd->dll) / sizeof (icd->dll[0]) );
-    icd->version = version;
-    icd->driver_version = driverVersion;
-    icd->flags = flags;
-
-    return ERROR_SUCCESS;
-}
-
-/* EOF */
-
diff --git a/dll/opengl/opengl32/opengl32.dsp b/dll/opengl/opengl32/opengl32.dsp
deleted file mode 100644 (file)
index 32466e2..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-# Microsoft Developer Studio Project File - Name="opengl32" - Package Owner=<4>\r
-# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
-# ** DO NOT EDIT **\r
-\r
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102\r
-\r
-CFG=opengl32 - Win32 Debug\r
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
-!MESSAGE use the Export Makefile command and run\r
-!MESSAGE \r
-!MESSAGE NMAKE /f "opengl32.mak".\r
-!MESSAGE \r
-!MESSAGE You can specify a configuration when running NMAKE\r
-!MESSAGE by defining the macro CFG on the command line. For example:\r
-!MESSAGE \r
-!MESSAGE NMAKE /f "opengl32.mak" CFG="opengl32 - Win32 Debug"\r
-!MESSAGE \r
-!MESSAGE Possible choices for configuration are:\r
-!MESSAGE \r
-!MESSAGE "opengl32 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")\r
-!MESSAGE "opengl32 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")\r
-!MESSAGE \r
-\r
-# Begin Project\r
-# PROP AllowPerConfigDependencies 0\r
-# PROP Scc_ProjName ""\r
-# PROP Scc_LocalPath ""\r
-CPP=cl.exe\r
-MTL=midl.exe\r
-RSC=rc.exe\r
-\r
-!IF  "$(CFG)" == "opengl32 - Win32 Release"\r
-\r
-# PROP BASE Use_MFC 0\r
-# PROP BASE Use_Debug_Libraries 0\r
-# PROP BASE Output_Dir "Release"\r
-# PROP BASE Intermediate_Dir "Release"\r
-# PROP BASE Target_Dir ""\r
-# PROP Use_MFC 0\r
-# PROP Use_Debug_Libraries 0\r
-# PROP Output_Dir "Release"\r
-# PROP Intermediate_Dir "Release"\r
-# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENGL32_EXPORTS" /YX /FD /c\r
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENGL32_EXPORTS" /YX /FD /c\r
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
-# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
-# ADD RSC /l 0x409 /d "NDEBUG"\r
-BSC32=bscmake.exe\r
-# ADD BASE BSC32 /nologo\r
-# ADD BSC32 /nologo\r
-LINK32=link.exe\r
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386\r
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386\r
-\r
-!ELSEIF  "$(CFG)" == "opengl32 - Win32 Debug"\r
-\r
-# PROP BASE Use_MFC 0\r
-# PROP BASE Use_Debug_Libraries 1\r
-# PROP BASE Output_Dir "Debug"\r
-# PROP BASE Intermediate_Dir "Debug"\r
-# PROP BASE Target_Dir ""\r
-# PROP Use_MFC 0\r
-# PROP Use_Debug_Libraries 1\r
-# PROP Output_Dir "Debug"\r
-# PROP Intermediate_Dir "Debug"\r
-# PROP Ignore_Export_Lib 0\r
-# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENGL32_EXPORTS" /YX /FD /GZ /c\r
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENGL32_EXPORTS" /YX /FD /TP /GZ /c\r
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
-# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
-# ADD RSC /l 0x409 /d "_DEBUG"\r
-BSC32=bscmake.exe\r
-# ADD BASE BSC32 /nologo\r
-# ADD BSC32 /nologo\r
-LINK32=link.exe\r
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 gdi32.lib advapi32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept\r
-\r
-!ENDIF \r
-\r
-# Begin Target\r
-\r
-# Name "opengl32 - Win32 Release"\r
-# Name "opengl32 - Win32 Debug"\r
-# Begin Group "Source Files"\r
-\r
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
-# Begin Source File\r
-\r
-SOURCE=.\gl.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\opengl32.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\tebimports.asm\r
-\r
-!IF  "$(CFG)" == "opengl32 - Win32 Release"\r
-\r
-# Begin Custom Build - Compiling $(InputPath)\r
-IntDir=.\Release\r
-InputPath=.\tebimports.asm\r
-InputName=tebimports\r
-\r
-"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
-       nasmw.exe -f win32 $(InputPath) -o "$(IntDir)/$(InputName).obj"\r
-\r
-# End Custom Build\r
-\r
-!ELSEIF  "$(CFG)" == "opengl32 - Win32 Debug"\r
-\r
-# Begin Custom Build - Compiling $(InputPath)\r
-IntDir=.\Debug\r
-InputPath=.\tebimports.asm\r
-InputName=tebimports\r
-\r
-"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
-       nasmw.exe -f win32 -d win32 $(InputPath) -o "$(IntDir)/$(InputName).obj"\r
-\r
-# End Custom Build\r
-\r
-!ENDIF \r
-\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\wgl.c\r
-# End Source File\r
-# End Group\r
-# Begin Group "Header Files"\r
-\r
-# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
-# Begin Source File\r
-\r
-SOURCE=.\glfuncs.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\icdlist.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\icdtable.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\opengl32.def\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\opengl32.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\slowlist.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\teb.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\teblist.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\teblist.mac\r
-# End Source File\r
-# End Group\r
-# Begin Group "Resource Files"\r
-\r
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
-# End Group\r
-# End Target\r
-# End Project\r
diff --git a/dll/opengl/opengl32/opengl32.dsw b/dll/opengl/opengl32/opengl32.dsw
deleted file mode 100644 (file)
index 1f1dc84..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00\r
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r
-\r
-###############################################################################\r
-\r
-Project: "opengl32"=.\opengl32.dsp - Package Owner=<4>\r
-\r
-Package=<5>\r
-{{{\r
-}}}\r
-\r
-Package=<4>\r
-{{{\r
-}}}\r
-\r
-###############################################################################\r
-\r
-Global:\r
-\r
-Package=<5>\r
-{{{\r
-}}}\r
-\r
-Package=<3>\r
-{{{\r
-}}}\r
-\r
-###############################################################################\r
-\r
diff --git a/dll/win32/devmgr/advprop.c b/dll/win32/devmgr/advprop.c
deleted file mode 100644 (file)
index 2b83fb5..0000000
+++ /dev/null
@@ -1,3308 +0,0 @@
-/*
- * ReactOS Device Manager Applet
- * Copyright (C) 2004 - 2005 ReactOS Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-/*
- *
- * PROJECT:         ReactOS devmgr.dll
- * FILE:            lib/devmgr/advprop.c
- * PURPOSE:         ReactOS Device Manager
- * PROGRAMMER:      Thomas Weidenmueller <w3seek@reactos.com>
- *                  Ged Murphy <gedmurphy@reactos.org>
- * UPDATE HISTORY:
- *      04-04-2004  Created
- */
-
-#include "precomp.h"
-
-#include <winver.h>
-
-
-static UINT WINAPI
-EnumDeviceDriverFilesCallback(IN PVOID Context,
-                              IN UINT Notification,
-                              IN UINT_PTR Param1,
-                              IN UINT_PTR Param2)
-{
-    LVITEM li;
-    PENUMDRIVERFILES_CONTEXT EnumDriverFilesContext = (PENUMDRIVERFILES_CONTEXT)Context;
-
-    li.mask = LVIF_TEXT | LVIF_STATE;
-    li.iItem = EnumDriverFilesContext->nCount++;
-    li.iSubItem = 0;
-    li.state = (li.iItem == 0 ? LVIS_SELECTED : 0);
-    li.stateMask = LVIS_SELECTED;
-    li.pszText = (LPWSTR)Param1;
-    (void)ListView_InsertItem(EnumDriverFilesContext->hDriversListView,
-                              &li);
-    return NO_ERROR;
-}
-
-
-static VOID
-UpdateDriverDetailsDlg(IN HWND hwndDlg,
-                       IN HWND hDriversListView,
-                       IN PDEVADVPROP_INFO dap)
-{
-    HDEVINFO DeviceInfoSet;
-    PSP_DEVINFO_DATA DeviceInfoData;
-    SP_DRVINFO_DATA DriverInfoData;
-    ENUMDRIVERFILES_CONTEXT EnumDriverFilesContext;
-
-    if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
-    {
-        DeviceInfoSet = dap->CurrentDeviceInfoSet;
-        DeviceInfoData = &dap->CurrentDeviceInfoData;
-    }
-    else
-    {
-        DeviceInfoSet = dap->DeviceInfoSet;
-        DeviceInfoData = &dap->DeviceInfoData;
-    }
-
-    /* set the device image */
-    SendDlgItemMessage(hwndDlg,
-                       IDC_DEVICON,
-                       STM_SETICON,
-                       (WPARAM)dap->hDevIcon,
-                       0);
-
-    /* set the device name edit control text */
-    SetDlgItemText(hwndDlg,
-                   IDC_DEVNAME,
-                   dap->szDevName);
-
-    /* fill the driver files list view */
-    EnumDriverFilesContext.hDriversListView = hDriversListView;
-    EnumDriverFilesContext.nCount = 0;
-
-    (void)ListView_DeleteAllItems(EnumDriverFilesContext.hDriversListView);
-    DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA);
-    if (FindCurrentDriver(DeviceInfoSet,
-                          DeviceInfoData,
-                          &DriverInfoData) &&
-        SetupDiSetSelectedDriver(DeviceInfoSet,
-                                 DeviceInfoData,
-                                 &DriverInfoData))
-    {
-        HSPFILEQ queueHandle;
-
-        queueHandle = SetupOpenFileQueue();
-        if (queueHandle != (HSPFILEQ)INVALID_HANDLE_VALUE)
-        {
-            SP_DEVINSTALL_PARAMS DeviceInstallParams = {0};
-            DeviceInstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
-            if (SetupDiGetDeviceInstallParams(DeviceInfoSet,
-                                              DeviceInfoData,
-                                              &DeviceInstallParams))
-            {
-                DeviceInstallParams.FileQueue = queueHandle;
-                DeviceInstallParams.Flags |= DI_NOVCP;
-
-                if (SetupDiSetDeviceInstallParams(DeviceInfoSet,
-                                                  DeviceInfoData,
-                                                  &DeviceInstallParams) &&
-                    SetupDiCallClassInstaller(DIF_INSTALLDEVICEFILES,
-                                              DeviceInfoSet,
-                                              DeviceInfoData))
-                {
-                    DWORD scanResult;
-                    RECT rcClient;
-                    LVCOLUMN lvc;
-
-                    /* enumerate the driver files */
-                    SetupScanFileQueue(queueHandle,
-                                       SPQ_SCAN_USE_CALLBACK,
-                                       NULL,
-                                       EnumDeviceDriverFilesCallback,
-                                       &EnumDriverFilesContext,
-                                       &scanResult);
-
-                    /* update the list view column width */
-                    GetClientRect(hDriversListView,
-                                  &rcClient);
-                    lvc.mask = LVCF_WIDTH;
-                    lvc.cx = rcClient.right;
-                    (void)ListView_SetColumn(hDriversListView,
-                                             0,
-                                             &lvc);
-
-                    /* highlight the first item from list */
-                    if (ListView_GetSelectedCount(hDriversListView) != 0)
-                    {
-                        ListView_SetItemState(hDriversListView,
-                                              0,
-                                              LVIS_FOCUSED | LVIS_SELECTED,
-                                              LVIS_FOCUSED | LVIS_SELECTED);
-                    }
-                }
-            }
-
-            SetupCloseFileQueue(queueHandle);
-        }
-    }
-}
-
-
-static VOID
-UpdateDriverVersionInfoDetails(IN HWND hwndDlg,
-                               IN LPCWSTR lpszDriverPath)
-{
-    DWORD dwHandle;
-    DWORD dwVerInfoSize;
-    LPVOID lpData = NULL;
-    LPVOID lpInfo;
-    UINT uInfoLen;
-    DWORD dwLangId;
-    WCHAR szLangInfo[255];
-    WCHAR szLangPath[MAX_PATH];
-    LPWSTR lpCompanyName = NULL;
-    LPWSTR lpFileVersion = NULL;
-    LPWSTR lpLegalCopyright = NULL;
-    LPWSTR lpDigitalSigner = NULL;
-    UINT uBufLen;
-    WCHAR szNotAvailable[255];
-
-    /* extract version info from selected file */
-    dwVerInfoSize = GetFileVersionInfoSize(lpszDriverPath,
-                                           &dwHandle);
-    if (!dwVerInfoSize)
-        goto done;
-
-    lpData = HeapAlloc(GetProcessHeap(),
-                       HEAP_ZERO_MEMORY,
-                       dwVerInfoSize);
-    if (!lpData)
-        goto done;
-
-    if (!GetFileVersionInfo(lpszDriverPath,
-                            dwHandle,
-                            dwVerInfoSize,
-                            lpData))
-        goto done;
-
-    if (!VerQueryValue(lpData,
-                       L"\\VarFileInfo\\Translation",
-                       &lpInfo,
-                       &uInfoLen))
-        goto done;
-
-    dwLangId = *(LPDWORD)lpInfo;
-    swprintf(szLangInfo, L"\\StringFileInfo\\%04x%04x\\",
-             LOWORD(dwLangId), HIWORD(dwLangId));
-
-    /* read CompanyName */
-    wcscpy(szLangPath, szLangInfo);
-    wcscat(szLangPath, L"CompanyName");
-
-    VerQueryValue(lpData,
-                  szLangPath,
-                  (void **)&lpCompanyName,
-                  (PUINT)&uBufLen);
-
-    /* read FileVersion */
-    wcscpy(szLangPath, szLangInfo);
-    wcscat(szLangPath, L"FileVersion");
-
-    VerQueryValue(lpData,
-                  szLangPath,
-                  (void **)&lpFileVersion,
-                  (PUINT)&uBufLen);
-
-    /* read LegalTrademarks */
-    wcscpy(szLangPath, szLangInfo);
-    wcscat(szLangPath, L"LegalCopyright");
-
-    VerQueryValue(lpData,
-                  szLangPath,
-                  (void **)&lpLegalCopyright,
-                  (PUINT)&uBufLen);
-
-    /* TODO: read digital signer info */
-
-done:
-    if (!LoadString(hDllInstance,
-                    IDS_NOTAVAILABLE,
-                    szNotAvailable,
-                    sizeof(szNotAvailable) / sizeof(WCHAR)))
-    {
-        wcscpy(szNotAvailable, L"n/a");
-    }
-
-    /* update labels */
-    if (!lpCompanyName)
-        lpCompanyName = szNotAvailable;
-    SetDlgItemText(hwndDlg,
-                   IDC_FILEPROVIDER,
-                   lpCompanyName);
-
-    if (!lpFileVersion)
-        lpFileVersion = szNotAvailable;
-    SetDlgItemText(hwndDlg,
-                   IDC_FILEVERSION,
-                   lpFileVersion);
-
-    if (!lpLegalCopyright)
-        lpLegalCopyright = szNotAvailable;
-    SetDlgItemText(hwndDlg,
-                   IDC_FILECOPYRIGHT,
-                   lpLegalCopyright);
-
-    if (!lpDigitalSigner)
-        lpDigitalSigner = szNotAvailable;
-    SetDlgItemText(hwndDlg,
-                   IDC_DIGITALSIGNER,
-                   lpDigitalSigner);
-
-    /* release version info */
-    if (lpData)
-        HeapFree(GetProcessHeap(),
-                 0,
-                 lpData);
-}
-
-
-static INT_PTR
-CALLBACK
-DriverDetailsDlgProc(IN HWND hwndDlg,
-                     IN UINT uMsg,
-                     IN WPARAM wParam,
-                     IN LPARAM lParam)
-{
-    PDEVADVPROP_INFO dap;
-    INT_PTR Ret = FALSE;
-
-    dap = (PDEVADVPROP_INFO)GetWindowLongPtr(hwndDlg,
-                                             DWL_USER);
-
-    if (dap != NULL || uMsg == WM_INITDIALOG)
-    {
-        switch (uMsg)
-        {
-            case WM_COMMAND:
-            {
-                switch (LOWORD(wParam))
-                {
-                    case IDOK:
-                    case IDCANCEL:
-                    {
-                        EndDialog(hwndDlg,
-                                  IDOK);
-                        break;
-                    }
-                }
-                break;
-            }
-
-            case WM_CLOSE:
-            {
-                EndDialog(hwndDlg,
-                          IDCANCEL);
-                break;
-            }
-
-            case WM_INITDIALOG:
-            {
-                LV_COLUMN lvc;
-                HWND hDriversListView;
-                WCHAR szBuffer[260];
-
-                dap = (PDEVADVPROP_INFO)lParam;
-                if (dap != NULL)
-                {
-                    SetWindowLongPtr(hwndDlg,
-                                     DWL_USER,
-                                     (DWORD_PTR)dap);
-
-                    hDriversListView = GetDlgItem(hwndDlg,
-                                                  IDC_DRIVERFILES);
-
-                    /* add a column to the list view control */
-                    lvc.mask = LVCF_FMT | LVCF_WIDTH;
-                    lvc.fmt = LVCFMT_LEFT;
-                    lvc.cx = 0;
-                    (void)ListView_InsertColumn(hDriversListView,
-                                                0,
-                                                &lvc);
-
-                    UpdateDriverDetailsDlg(hwndDlg,
-                                           hDriversListView,
-                                           dap);
-
-                    if (ListView_GetItemCount(hDriversListView) == 0)
-                    {
-                        if(LoadStringW(hDllInstance, IDS_NODRIVERS, szBuffer, _countof(szBuffer)))
-                            MessageBoxW(hwndDlg, szBuffer, dap->szDevName, MB_OK);
-                        EndDialog(hwndDlg, IDCANCEL);
-                    }
-                }
-
-                Ret = TRUE;
-                break;
-            }
-
-            case WM_NOTIFY:
-            {
-                LPNMHDR pnmhdr = (LPNMHDR)lParam;
-
-                switch (pnmhdr->code)
-                {
-                case LVN_ITEMCHANGED:
-                    {
-                        LPNMLISTVIEW pnmv = (LPNMLISTVIEW)lParam;
-                        HWND hDriversListView = GetDlgItem(hwndDlg,
-                                                           IDC_DRIVERFILES);
-
-                        if (ListView_GetSelectedCount(hDriversListView) == 0)
-                        {
-                            /* nothing is selected - empty the labels */
-                            SetDlgItemText(hwndDlg,
-                                           IDC_FILEPROVIDER,
-                                           NULL);
-                            SetDlgItemText(hwndDlg,
-                                           IDC_FILEVERSION,
-                                           NULL);
-                            SetDlgItemText(hwndDlg,
-                                           IDC_FILECOPYRIGHT,
-                                           NULL);
-                            SetDlgItemText(hwndDlg,
-                                           IDC_DIGITALSIGNER,
-                                           NULL);
-                        }
-                        else if (pnmv->uNewState != 0)
-                        {
-                            /* extract version info and update the labels */
-                            WCHAR szDriverPath[MAX_PATH];
-
-                            ListView_GetItemText(hDriversListView,
-                                                 pnmv->iItem,
-                                                 pnmv->iSubItem,
-                                                 szDriverPath,
-                                                 MAX_PATH);
-
-                            UpdateDriverVersionInfoDetails(hwndDlg,
-                                                           szDriverPath);
-                        }
-                    }
-                }
-                break;
-            }
-        }
-    }
-
-    return Ret;
-}
-
-
-static
-VOID
-UpdateDriver(
-    IN HWND hwndDlg,
-    IN PDEVADVPROP_INFO dap)
-{
-    TOKEN_PRIVILEGES Privileges;
-    HANDLE hToken;
-    DWORD dwReboot;
-    BOOL NeedReboot = FALSE;
-
-    // Better use InstallDevInst:
-    //     BOOL
-    //     WINAPI
-    //     InstallDevInst(
-    //         HWND hWnd,
-    //         LPWSTR wszDeviceId,
-    //         BOOL bUpdate,
-    //         DWORD *dwReboot);
-    // See: http://comp.os.ms-windows.programmer.win32.narkive.com/J8FTd4KK/signature-of-undocumented-installdevinstex
-
-    if (!InstallDevInst(hwndDlg, dap->szDeviceID, TRUE, &dwReboot))
-        return;
-
-    if (NeedReboot == FALSE)
-        return;
-
-    //FIXME: load text from resource file
-    if (MessageBoxW(hwndDlg, L"Reboot now?", L"Reboot required", MB_YESNO | MB_ICONQUESTION) != IDYES)
-        return;
-
-    if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken))
-    {
-        ERR("OpenProcessToken failed\n");
-        return;
-    }
-
-    /* Get the LUID for the Shutdown privilege */
-    if (!LookupPrivilegeValueW(NULL, SE_SHUTDOWN_NAME, &Privileges.Privileges[0].Luid))
-    {
-        ERR("LookupPrivilegeValue failed\n");
-        CloseHandle(hToken);
-        return;
-    }
-
-    /* Assign the Shutdown privilege to our process */
-    Privileges.PrivilegeCount = 1;
-    Privileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
-
-    if (!AdjustTokenPrivileges(hToken, FALSE, &Privileges, 0, NULL, NULL))
-    {
-        ERR("AdjustTokenPrivileges failed\n");
-        CloseHandle(hToken);
-        return;
-    }
-
-    /* Finally shut down the system */
-    if (!ExitWindowsEx(EWX_REBOOT, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED))
-    {
-        ERR("ExitWindowsEx failed\n");
-        CloseHandle(hToken);
-    }
-}
-
-
-static VOID
-UpdateDriverDlg(IN HWND hwndDlg,
-                IN PDEVADVPROP_INFO dap)
-{
-    HDEVINFO DeviceInfoSet;
-    PSP_DEVINFO_DATA DeviceInfoData;
-
-    if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
-    {
-        DeviceInfoSet = dap->CurrentDeviceInfoSet;
-        DeviceInfoData = &dap->CurrentDeviceInfoData;
-    }
-    else
-    {
-        DeviceInfoSet = dap->DeviceInfoSet;
-        DeviceInfoData = &dap->DeviceInfoData;
-    }
-
-    /* set the device image */
-    SendDlgItemMessage(hwndDlg,
-                       IDC_DEVICON,
-                       STM_SETICON,
-                       (WPARAM)dap->hDevIcon,
-                       0);
-
-    /* set the device name edit control text */
-    SetDlgItemText(hwndDlg,
-                   IDC_DEVNAME,
-                   dap->szDevName);
-
-    /* query the driver provider */
-    if (GetDriverProviderString(DeviceInfoSet,
-                                DeviceInfoData,
-                                dap->szTemp,
-                                sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
-    {
-        SetDlgItemText(hwndDlg,
-                       IDC_DRVPROVIDER,
-                       dap->szTemp);
-    }
-
-    /* query the driver date */
-    if (GetDriverDateString(DeviceInfoSet,
-                            DeviceInfoData,
-                            dap->szTemp,
-                            sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
-    {
-        SetDlgItemText(hwndDlg,
-                       IDC_DRVDATE,
-                       dap->szTemp);
-    }
-
-    /* query the driver version */
-    if (GetDriverVersionString(DeviceInfoSet,
-                               DeviceInfoData,
-                               dap->szTemp,
-                               sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
-    {
-        SetDlgItemText(hwndDlg,
-                       IDC_DRVVERSION,
-                       dap->szTemp);
-    }
-}
-
-
-static INT_PTR
-CALLBACK
-AdvProcDriverDlgProc(IN HWND hwndDlg,
-                     IN UINT uMsg,
-                     IN WPARAM wParam,
-                     IN LPARAM lParam)
-{
-    PDEVADVPROP_INFO dap;
-    INT_PTR Ret = FALSE;
-
-    dap = (PDEVADVPROP_INFO)GetWindowLongPtr(hwndDlg,
-                                             DWL_USER);
-
-    if (dap != NULL || uMsg == WM_INITDIALOG)
-    {
-        switch (uMsg)
-        {
-            case WM_COMMAND:
-            {
-                switch (LOWORD(wParam))
-                {
-                    case IDC_DRIVERDETAILS:
-                        DialogBoxParam(hDllInstance,
-                                       MAKEINTRESOURCE(IDD_DRIVERDETAILS),
-                                       hwndDlg,
-                                       DriverDetailsDlgProc,
-                                       (ULONG_PTR)dap);
-                        break;
-
-                    case IDC_UPDATEDRIVER:
-                        UpdateDriver(hwndDlg, dap);
-                        break;
-                }
-                break;
-            }
-
-            case WM_NOTIFY:
-            {
-                NMHDR *hdr = (NMHDR*)lParam;
-                switch (hdr->code)
-                {
-                    case PSN_APPLY:
-                        break;
-                }
-                break;
-            }
-
-            case WM_INITDIALOG:
-            {
-                dap = (PDEVADVPROP_INFO)((LPPROPSHEETPAGE)lParam)->lParam;
-                if (dap != NULL)
-                {
-                    SetWindowLongPtr(hwndDlg,
-                                     DWL_USER,
-                                     (DWORD_PTR)dap);
-
-                    UpdateDriverDlg(hwndDlg,
-                                    dap);
-                }
-                Ret = TRUE;
-                break;
-            }
-        }
-    }
-
-    return Ret;
-}
-
-
-static VOID
-SetListViewText(HWND hwnd,
-                INT iItem,
-                LPWSTR lpText)
-{
-    LVITEM li;
-
-    li.mask = LVIF_TEXT | LVIF_STATE;
-    li.iItem = iItem;
-    li.iSubItem = 0;
-    li.state = 0; //(li.iItem == 0 ? LVIS_SELECTED : 0);
-    li.stateMask = LVIS_SELECTED;
-    li.pszText = lpText;
-    (void)ListView_InsertItem(hwnd,
-                              &li);
-}
-
-
-static VOID
-UpdateDetailsDlg(IN HWND hwndDlg,
-                 IN PDEVADVPROP_INFO dap)
-{
-    HWND hwndComboBox;
-    HWND hwndListView;
-    LV_COLUMN lvc;
-    RECT rcClient;
-
-    UINT i;
-    UINT Properties[] =
-    {
-        IDS_PROP_DEVICEID,
-        IDS_PROP_HARDWAREIDS,
-        IDS_PROP_COMPATIBLEIDS,
-        IDS_PROP_MATCHINGDEVICEID,
-        IDS_PROP_SERVICE,
-        IDS_PROP_ENUMERATOR,
-        IDS_PROP_CAPABILITIES,
-        IDS_PROP_DEVNODEFLAGS,
-        IDS_PROP_CONFIGFLAGS,
-        IDS_PROP_CSCONFIGFLAGS,
-        IDS_PROP_EJECTIONRELATIONS,
-        IDS_PROP_REMOVALRELATIONS,
-        IDS_PROP_BUSRELATIONS,
-        IDS_PROP_DEVUPPERFILTERS,
-        IDS_PROP_DEVLOWERFILTERS,
-        IDS_PROP_CLASSUPPERFILTERS,
-        IDS_PROP_CLASSLOWERFILTERS,
-        IDS_PROP_CLASSINSTALLER,
-        IDS_PROP_CLASSCOINSTALLER,
-        IDS_PROP_DEVICECOINSTALLER,
-        IDS_PROP_FIRMWAREREVISION,
-        IDS_PROP_CURRENTPOWERSTATE,
-        IDS_PROP_POWERCAPABILITIES,
-        IDS_PROP_POWERSTATEMAPPINGS
-    };
-
-
-    /* set the device image */
-    SendDlgItemMessage(hwndDlg,
-                       IDC_DEVICON,
-                       STM_SETICON,
-                       (WPARAM)dap->hDevIcon,
-                       0);
-
-    /* set the device name edit control text */
-    SetDlgItemText(hwndDlg,
-                   IDC_DEVNAME,
-                   dap->szDevName);
-
-
-    hwndComboBox = GetDlgItem(hwndDlg,
-                              IDC_DETAILSPROPNAME);
-
-    hwndListView = GetDlgItem(hwndDlg,
-                              IDC_DETAILSPROPVALUE);
-
-    for (i = 0; i != sizeof(Properties) / sizeof(Properties[0]); i++)
-    {
-        /* fill in the device usage combo box */
-        if (LoadString(hDllInstance,
-                       Properties[i],
-                       dap->szTemp,
-                       sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
-        {
-            SendMessage(hwndComboBox,
-                        CB_ADDSTRING,
-                        0,
-                        (LPARAM)dap->szTemp);
-        }
-    }
-
-
-    GetClientRect(hwndListView,
-                  &rcClient);
-
-    /* add a column to the list view control */
-    lvc.mask = LVCF_FMT | LVCF_WIDTH;
-    lvc.fmt = LVCFMT_LEFT;
-    lvc.cx = rcClient.right;
-    (void)ListView_InsertColumn(hwndListView,
-                                0,
-                                &lvc);
-
-    SendMessage(hwndComboBox,
-                CB_SETCURSEL,
-                0,
-                0);
-
-    SetListViewText(hwndListView, 0, dap->szDeviceID);
-
-    SetFocus(hwndComboBox);
-}
-
-
-static VOID
-DisplayDevicePropertyText(IN PDEVADVPROP_INFO dap,
-                          IN HWND hwndListView,
-                          IN DWORD dwProperty)
-{
-    HDEVINFO DeviceInfoSet;
-    PSP_DEVINFO_DATA DeviceInfoData;
-    DWORD dwType;
-    DWORD dwSize;
-    DWORD dwValue;
-    LPBYTE lpBuffer;
-    LPWSTR lpStr;
-    INT len;
-    INT index;
-
-    if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
-    {
-        DeviceInfoSet = dap->CurrentDeviceInfoSet;
-        DeviceInfoData = &dap->CurrentDeviceInfoData;
-    }
-    else
-    {
-        DeviceInfoSet = dap->DeviceInfoSet;
-        DeviceInfoData = &dap->DeviceInfoData;
-    }
-
-    dwSize = 0;
-    SetupDiGetDeviceRegistryProperty(DeviceInfoSet,
-                                     DeviceInfoData,
-                                     dwProperty,
-                                     &dwType,
-                                     NULL,
-                                     0,
-                                     &dwSize);
-    if (dwSize == 0)
-    {
-        if (GetLastError() != ERROR_FILE_NOT_FOUND)
-        {
-            swprintf(dap->szTemp, L"Error: Getting the size failed! (Error: %ld)", GetLastError());
-            SetListViewText(hwndListView, 0, dap->szTemp);
-        }
-        return;
-    }
-
-    if (dwType == REG_SZ)
-        dwSize += sizeof(WCHAR);
-
-    lpBuffer = HeapAlloc(GetProcessHeap(),
-                         HEAP_ZERO_MEMORY,
-                         dwSize);
-    if (lpBuffer == NULL)
-    {
-        SetListViewText(hwndListView, 0, L"Error: Allocating the buffer failed!");
-        return;
-    }
-
-    if (SetupDiGetDeviceRegistryProperty(DeviceInfoSet,
-                                         DeviceInfoData,
-                                         dwProperty,
-                                         &dwType,
-                                         lpBuffer,
-                                         dwSize,
-                                         &dwSize))
-    {
-        if (dwType == REG_SZ)
-        {
-            SetListViewText(hwndListView, 0, (LPWSTR)lpBuffer);
-        }
-        else if (dwType == REG_MULTI_SZ)
-        {
-            lpStr = (LPWSTR)lpBuffer;
-            index = 0;
-            while (*lpStr != 0)
-            {
-                len = wcslen(lpStr) + 1;
-
-                SetListViewText(hwndListView, index, lpStr);
-
-                lpStr += len;
-                index++;
-            }
-        }
-        else if (dwType == REG_DWORD)
-        {
-            dwValue = *(DWORD *) lpBuffer;
-
-            switch (dwProperty)
-            {
-                case SPDRP_CAPABILITIES:
-                    index = 0;
-                    if (dwValue & CM_DEVCAP_LOCKSUPPORTED)
-                        SetListViewText(hwndListView, index++, L"CM_DEVCAP_LOCKSUPPORTED");
-                    if (dwValue & CM_DEVCAP_EJECTSUPPORTED)
-                        SetListViewText(hwndListView, index++, L"CM_DEVCAP_EJECTSUPPORTED");
-                    if (dwValue & CM_DEVCAP_REMOVABLE)
-                        SetListViewText(hwndListView, index++, L"CM_DEVCAP_REMOVABLE");
-                    if (dwValue & CM_DEVCAP_DOCKDEVICE)
-                        SetListViewText(hwndListView, index++, L"CM_DEVCAP_DOCKDEVICE");
-                    if (dwValue & CM_DEVCAP_UNIQUEID)
-                        SetListViewText(hwndListView, index++, L"CM_DEVCAP_UNIQUEID");
-                    if (dwValue & CM_DEVCAP_SILENTINSTALL)
-                        SetListViewText(hwndListView, index++, L"CM_DEVCAP_SILENTINSTALL");
-                    if (dwValue & CM_DEVCAP_RAWDEVICEOK)
-                        SetListViewText(hwndListView, index++, L"CM_DEVCAP_RAWDEVICEOK");
-                    if (dwValue & CM_DEVCAP_SURPRISEREMOVALOK)
-                        SetListViewText(hwndListView, index++, L"CM_DEVCAP_SURPRISEREMOVALOK");
-                    if (dwValue & CM_DEVCAP_HARDWAREDISABLED)
-                        SetListViewText(hwndListView, index++, L"CM_DEVCAP_HARDWAREDISABLED");
-                    if (dwValue & CM_DEVCAP_NONDYNAMIC)
-                        SetListViewText(hwndListView, index++, L"CM_DEVCAP_NONDYNAMIC");
-                    break;
-
-                case SPDRP_CONFIGFLAGS:
-                    index = 0;
-                    if (dwValue & CONFIGFLAG_DISABLED)
-                        SetListViewText(hwndListView, index++, L"CONFIGFLAG_DISABLED");
-                    if (dwValue & CONFIGFLAG_REMOVED)
-                        SetListViewText(hwndListView, index++, L"CONFIGFLAG_REMOVED");
-                    if (dwValue & CONFIGFLAG_MANUAL_INSTALL)
-                        SetListViewText(hwndListView, index++, L"CONFIGFLAG_MANUAL_INSTALL");
-                    if (dwValue & CONFIGFLAG_IGNORE_BOOT_LC)
-                        SetListViewText(hwndListView, index++, L"CONFIGFLAG_IGNORE_BOOT_LC");
-                    if (dwValue & CONFIGFLAG_NET_BOOT)
-                        SetListViewText(hwndListView, index++, L"CONFIGFLAG_NET_BOOT");
-                    if (dwValue & CONFIGFLAG_REINSTALL)
-                        SetListViewText(hwndListView, index++, L"CONFIGFLAG_REINSTALL");
-                    if (dwValue & CONFIGFLAG_FAILEDINSTALL)
-                        SetListViewText(hwndListView, index++, L"CONFIGFLAG_FAILEDINSTALL");
-                    if (dwValue & CONFIGFLAG_CANTSTOPACHILD)
-                        SetListViewText(hwndListView, index++, L"CONFIGFLAG_CANTSTOPACHILD");
-                    if (dwValue & CONFIGFLAG_OKREMOVEROM)
-                        SetListViewText(hwndListView, index++, L"CONFIGFLAG_OKREMOVEROM");
-                    if (dwValue & CONFIGFLAG_NOREMOVEEXIT)
-                        SetListViewText(hwndListView, index++, L"CONFIGFLAG_NOREMOVEEXIT");
-                    break;
-
-                default:
-                    swprintf(dap->szTemp, L"0x%08lx", dwValue);
-                    SetListViewText(hwndListView, 0, dap->szTemp);
-                    break;
-            }
-        }
-        else
-        {
-            SetListViewText(hwndListView, 0, L"Error: Unsupported value type!");
-
-        }
-    }
-    else
-    {
-        SetListViewText(hwndListView, 0, L"Error: Retrieving the value failed!");
-    }
-
-    HeapFree(GetProcessHeap(),
-             0,
-             lpBuffer);
-}
-
-static VOID
-DisplayDevNodeFlags(IN PDEVADVPROP_INFO dap,
-                    IN HWND hwndListView)
-{
-    DWORD dwStatus = 0;
-    DWORD dwProblem = 0;
-    INT index;
-
-    CM_Get_DevNode_Status_Ex(&dwStatus,
-                             &dwProblem,
-                             dap->DeviceInfoData.DevInst,
-                             0,
-                             dap->hMachine);
-
-    index = 0;
-    if (dwStatus & DN_ROOT_ENUMERATED)
-        SetListViewText(hwndListView, index++, L"DN_ROOT_ENUMERATED");
-    if (dwStatus & DN_DRIVER_LOADED)
-        SetListViewText(hwndListView, index++, L"DN_DRIVER_LOADED");
-    if (dwStatus & DN_ENUM_LOADED)
-        SetListViewText(hwndListView, index++, L"DN_ENUM_LOADED");
-    if (dwStatus & DN_STARTED)
-        SetListViewText(hwndListView, index++, L"DN_STARTED");
-    if (dwStatus & DN_MANUAL)
-        SetListViewText(hwndListView, index++, L"DN_MANUAL");
-    if (dwStatus & DN_NEED_TO_ENUM)
-        SetListViewText(hwndListView, index++, L"DN_NEED_TO_ENUM");
-    if (dwStatus & DN_DRIVER_BLOCKED)
-        SetListViewText(hwndListView, index++, L"DN_DRIVER_BLOCKED");
-    if (dwStatus & DN_HARDWARE_ENUM)
-        SetListViewText(hwndListView, index++, L"DN_HARDWARE_ENUM");
-    if (dwStatus & DN_NEED_RESTART)
-        SetListViewText(hwndListView, index++, L"DN_NEED_RESTART");
-    if (dwStatus & DN_CHILD_WITH_INVALID_ID)
-        SetListViewText(hwndListView, index++, L"DN_CHILD_WITH_INVALID_ID");
-    if (dwStatus & DN_HAS_PROBLEM)
-        SetListViewText(hwndListView, index++, L"DN_HAS_PROBLEM");
-    if (dwStatus & DN_FILTERED)
-        SetListViewText(hwndListView, index++, L"DN_FILTERED");
-    if (dwStatus & DN_LEGACY_DRIVER)
-        SetListViewText(hwndListView, index++, L"DN_LEGACY_DRIVER");
-    if (dwStatus & DN_DISABLEABLE)
-        SetListViewText(hwndListView, index++, L"DN_DISABLEABLE");
-    if (dwStatus & DN_REMOVABLE)
-        SetListViewText(hwndListView, index++, L"DN_REMOVABLE");
-    if (dwStatus & DN_PRIVATE_PROBLEM)
-        SetListViewText(hwndListView, index++, L"DN_PRIVATE_PROBLEM");
-    if (dwStatus & DN_MF_PARENT)
-        SetListViewText(hwndListView, index++, L"DN_MF_PARENT");
-    if (dwStatus & DN_MF_CHILD)
-        SetListViewText(hwndListView, index++, L"DN_MF_CHILD");
-    if (dwStatus & DN_WILL_BE_REMOVED)
-        SetListViewText(hwndListView, index++, L"DN_WILL_BE_REMOVED");
-
-    if (dwStatus & DN_NOT_FIRST_TIMEE)
-        SetListViewText(hwndListView, index++, L"DN_NOT_FIRST_TIMEE");
-    if (dwStatus & DN_STOP_FREE_RES)
-        SetListViewText(hwndListView, index++, L"DN_STOP_FREE_RES");
-    if (dwStatus & DN_REBAL_CANDIDATE)
-        SetListViewText(hwndListView, index++, L"DN_REBAL_CANDIDATE");
-    if (dwStatus & DN_BAD_PARTIAL)
-        SetListViewText(hwndListView, index++, L"DN_BAD_PARTIAL");
-    if (dwStatus & DN_NT_ENUMERATOR)
-        SetListViewText(hwndListView, index++, L"DN_NT_ENUMERATOR");
-    if (dwStatus & DN_NT_DRIVER)
-        SetListViewText(hwndListView, index++, L"DN_NT_DRIVER");
-
-    if (dwStatus & DN_NEEDS_LOCKING)
-        SetListViewText(hwndListView, index++, L"DN_NEEDS_LOCKING");
-    if (dwStatus & DN_ARM_WAKEUP)
-        SetListViewText(hwndListView, index++, L"DN_ARM_WAKEUP");
-    if (dwStatus & DN_APM_ENUMERATOR)
-        SetListViewText(hwndListView, index++, L"DN_APM_ENUMERATOR");
-    if (dwStatus & DN_APM_DRIVER)
-        SetListViewText(hwndListView, index++, L"DN_APM_DRIVER");
-    if (dwStatus & DN_SILENT_INSTALL)
-        SetListViewText(hwndListView, index++, L"DN_SILENT_INSTALL");
-    if (dwStatus & DN_NO_SHOW_IN_DM)
-        SetListViewText(hwndListView, index++, L"DN_NO_SHOW_IN_DM");
-    if (dwStatus & DN_BOOT_LOG_PROB)
-        SetListViewText(hwndListView, index++, L"DN_BOOT_LOG_PROB");
-
-//    swprintf(dap->szTemp, L"0x%08x", dwStatus);
-//    SetListViewText(hwndListView, 0, dap->szTemp);
-}
-
-
-static VOID
-DisplayDevNodeEnumerator(IN PDEVADVPROP_INFO dap,
-                         IN HWND hwndListView)
-{
-    PSP_DEVINFO_DATA DeviceInfoData;
-
-    DWORD dwType = 0;
-    WCHAR szBuffer[256];
-    DWORD dwSize = 256 * sizeof(WCHAR);
-
-    if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
-    {
-        DeviceInfoData = &dap->CurrentDeviceInfoData;
-    }
-    else
-    {
-        DeviceInfoData = &dap->DeviceInfoData;
-    }
-
-    CM_Get_DevNode_Registry_Property_ExW(DeviceInfoData->DevInst,
-                                         CM_DRP_ENUMERATOR_NAME,
-                                         &dwType,
-                                         &szBuffer,
-                                         &dwSize,
-                                         0,
-                                         dap->hMachine);
-
-    SetListViewText(hwndListView, 0, szBuffer);
-}
-
-
-static VOID
-DisplayCsFlags(IN PDEVADVPROP_INFO dap,
-               IN HWND hwndListView)
-{
-    DWORD dwValue = 0;
-    INT index;
-
-    CM_Get_HW_Prof_Flags_Ex(dap->szDevName,
-                            0, /* current hardware profile */
-                            &dwValue,
-                            0,
-                            dap->hMachine);
-
-    index = 0;
-    if (dwValue & CSCONFIGFLAG_DISABLED)
-        SetListViewText(hwndListView, index++, L"CSCONFIGFLAG_DISABLED");
-
-    if (dwValue & CSCONFIGFLAG_DO_NOT_CREATE)
-        SetListViewText(hwndListView, index++, L"CSCONFIGFLAG_DO_NOT_CREATE");
-
-    if (dwValue & CSCONFIGFLAG_DO_NOT_START)
-        SetListViewText(hwndListView, index++, L"CSCONFIGFLAG_DO_NOT_START");
-}
-
-
-static VOID
-DisplayMatchingDeviceId(IN PDEVADVPROP_INFO dap,
-                        IN HWND hwndListView)
-{
-    HDEVINFO DeviceInfoSet;
-    PSP_DEVINFO_DATA DeviceInfoData;
-    WCHAR szBuffer[256];
-    HKEY hKey;
-    DWORD dwSize;
-    DWORD dwType;
-
-    if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
-    {
-        DeviceInfoSet = dap->CurrentDeviceInfoSet;
-        DeviceInfoData = &dap->CurrentDeviceInfoData;
-    }
-    else
-    {
-        DeviceInfoSet = dap->DeviceInfoSet;
-        DeviceInfoData = &dap->DeviceInfoData;
-    }
-
-    hKey = SetupDiOpenDevRegKey(DeviceInfoSet,
-                                DeviceInfoData,
-                                DICS_FLAG_GLOBAL,
-                                0,
-                                DIREG_DRV,
-                                KEY_QUERY_VALUE);
-    if (hKey != INVALID_HANDLE_VALUE)
-    {
-        dwSize = 256 * sizeof(WCHAR);
-        if (RegQueryValueEx(hKey,
-                            L"MatchingDeviceId",
-                            NULL,
-                            &dwType,
-                            (LPBYTE)szBuffer,
-                            &dwSize) == ERROR_SUCCESS)
-        {
-            SetListViewText(hwndListView, 0, szBuffer);
-        }
-
-        RegCloseKey(hKey);
-    }
-}
-
-
-static VOID
-DisplayClassCoinstallers(IN PDEVADVPROP_INFO dap,
-                          IN HWND hwndListView)
-{
-    HDEVINFO DeviceInfoSet;
-    PSP_DEVINFO_DATA DeviceInfoData;
-    WCHAR szClassGuid[45];
-    HKEY hKey = INVALID_HANDLE_VALUE;
-    DWORD dwSize;
-    DWORD dwType;
-    LPBYTE lpBuffer = NULL;
-    LPWSTR lpStr;
-    INT index;
-    INT len;
-    LONG lError;
-
-    if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
-    {
-        DeviceInfoSet = dap->CurrentDeviceInfoSet;
-        DeviceInfoData = &dap->CurrentDeviceInfoData;
-    }
-    else
-    {
-        DeviceInfoSet = dap->DeviceInfoSet;
-        DeviceInfoData = &dap->DeviceInfoData;
-    }
-
-    dwSize = 45 * sizeof(WCHAR);
-    if (!SetupDiGetDeviceRegistryProperty(DeviceInfoSet,
-                                          DeviceInfoData,
-                                          SPDRP_CLASSGUID,
-                                          &dwType,
-                                          (LPBYTE)szClassGuid,
-                                          dwSize,
-                                          &dwSize))
-        return;
-
-    lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
-                           L"SYSTEM\\CurrentControlSet\\Control\\CoDeviceInstallers",
-                           0,
-                           GENERIC_READ,
-                           &hKey);
-    if (lError != ERROR_SUCCESS)
-        return;
-
-    dwSize = 0;
-    lError = RegQueryValueEx(hKey,
-                             szClassGuid,
-                             NULL,
-                             &dwType,
-                             NULL,
-                             &dwSize);
-    if (lError != ERROR_SUCCESS)
-        goto done;
-
-    if (dwSize == 0)
-        goto done;
-
-    lpBuffer = HeapAlloc(GetProcessHeap(),
-                         HEAP_ZERO_MEMORY,
-                         dwSize);
-
-    RegQueryValueEx(hKey,
-                    szClassGuid,
-                    NULL,
-                    &dwType,
-                    lpBuffer,
-                    &dwSize);
-
-    lpStr = (LPWSTR)lpBuffer;
-    index = 0;
-    while (*lpStr != 0)
-    {
-        len = wcslen(lpStr) + 1;
-
-        SetListViewText(hwndListView, index, lpStr);
-
-        lpStr += len;
-        index++;
-    }
-
-done:
-    if (lpBuffer != NULL)
-        HeapFree(GetProcessHeap(), 0, lpBuffer);
-
-    if (hKey != INVALID_HANDLE_VALUE)
-        RegCloseKey(hKey);
-}
-
-
-static VOID
-DisplayDeviceCoinstallers(IN PDEVADVPROP_INFO dap,
-                          IN HWND hwndListView)
-{
-    HDEVINFO DeviceInfoSet;
-    PSP_DEVINFO_DATA DeviceInfoData;
-    HKEY hKey;
-    DWORD dwSize;
-    DWORD dwType;
-    LPBYTE lpBuffer;
-    LPWSTR lpStr;
-    INT index;
-    INT len;
-
-    if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
-    {
-        DeviceInfoSet = dap->CurrentDeviceInfoSet;
-        DeviceInfoData = &dap->CurrentDeviceInfoData;
-    }
-    else
-    {
-        DeviceInfoSet = dap->DeviceInfoSet;
-        DeviceInfoData = &dap->DeviceInfoData;
-    }
-
-    hKey = SetupDiOpenDevRegKey(DeviceInfoSet,
-                                DeviceInfoData,
-                                DICS_FLAG_GLOBAL,
-                                0,
-                                DIREG_DRV,
-                                KEY_QUERY_VALUE);
-    if (hKey != INVALID_HANDLE_VALUE)
-    {
-        dwSize = 0;
-        if (RegQueryValueEx(hKey,
-                            L"CoInstallers32",
-                            NULL,
-                            &dwType,
-                            NULL,
-                            &dwSize) == ERROR_SUCCESS &&
-            dwSize > 0)
-        {
-
-            lpBuffer = HeapAlloc(GetProcessHeap(),
-                                 HEAP_ZERO_MEMORY,
-                                 dwSize);
-
-            RegQueryValueEx(hKey,
-                            L"CoInstallers32",
-                            NULL,
-                            &dwType,
-                            lpBuffer,
-                            &dwSize);
-
-            lpStr = (LPWSTR)lpBuffer;
-            index = 0;
-            while (*lpStr != 0)
-            {
-                len = wcslen(lpStr) + 1;
-
-                SetListViewText(hwndListView, index, lpStr);
-
-                lpStr += len;
-                index++;
-            }
-
-            HeapFree(GetProcessHeap(),
-                     0,
-                     lpBuffer);
-        }
-
-        RegCloseKey(hKey);
-    }
-}
-
-
-static VOID
-DisplayClassProperties(IN PDEVADVPROP_INFO dap,
-                       IN HWND hwndListView,
-                       IN LPWSTR lpProperty)
-{
-    HDEVINFO DeviceInfoSet;
-    PSP_DEVINFO_DATA DeviceInfoData;
-    WCHAR szClassGuid[45];
-    DWORD dwSize;
-    DWORD dwType;
-    HKEY hKey;
-    GUID ClassGuid;
-    LPBYTE lpBuffer;
-    LPWSTR lpStr;
-    INT index = 0;
-    INT len;
-
-    if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
-    {
-        DeviceInfoSet = dap->CurrentDeviceInfoSet;
-        DeviceInfoData = &dap->CurrentDeviceInfoData;
-    }
-    else
-    {
-        DeviceInfoSet = dap->DeviceInfoSet;
-        DeviceInfoData = &dap->DeviceInfoData;
-    }
-
-    dwSize = 45 * sizeof(WCHAR);
-    if (!SetupDiGetDeviceRegistryProperty(DeviceInfoSet,
-                                          DeviceInfoData,
-                                          SPDRP_CLASSGUID,
-                                          &dwType,
-                                          (LPBYTE)szClassGuid,
-                                          dwSize,
-                                          &dwSize))
-        return;
-
-    pSetupGuidFromString(szClassGuid,
-                         &ClassGuid);
-
-    hKey = SetupDiOpenClassRegKey(&ClassGuid,
-                                  KEY_QUERY_VALUE);
-    if (hKey != INVALID_HANDLE_VALUE)
-    {
-        dwSize = 0;
-        if (RegQueryValueEx(hKey,
-                            lpProperty,
-                            NULL,
-                            &dwType,
-                            NULL,
-                            &dwSize) == ERROR_SUCCESS &&
-            dwSize > 0)
-        {
-            lpBuffer = HeapAlloc(GetProcessHeap(),
-                                 HEAP_ZERO_MEMORY,
-                                 dwSize);
-
-            RegQueryValueEx(hKey,
-                            lpProperty,
-                            NULL,
-                            &dwType,
-                            lpBuffer,
-                            &dwSize);
-
-            if (dwType == REG_SZ)
-            {
-                SetListViewText(hwndListView, 0, (LPWSTR)lpBuffer);
-            }
-            else if (dwType == REG_MULTI_SZ)
-            {
-                lpStr = (LPWSTR)lpBuffer;
-                index = 0;
-                while (*lpStr != 0)
-                {
-                    len = wcslen(lpStr) + 1;
-
-                    SetListViewText(hwndListView, index, lpStr);
-
-                    lpStr += len;
-                    index++;
-                }
-            }
-
-            HeapFree(GetProcessHeap(),
-                     0,
-                     lpBuffer);
-        }
-
-        RegCloseKey(hKey);
-    }
-}
-
-
-static VOID
-DisplayDeviceRelations(
-    IN PDEVADVPROP_INFO dap,
-    IN HWND hwndListView,
-    IN ULONG ulFlags)
-{
-    ULONG ulLength = 0;
-    LPWSTR pszBuffer = NULL, pszStr;
-    INT index = 0, len;
-
-    CONFIGRET ret;
-
-    ret = CM_Get_Device_ID_List_Size_ExW(&ulLength,
-                                         dap->szDeviceID,
-                                         ulFlags,
-                                         NULL);
-    if (ret != CR_SUCCESS)
-        return;
-
-    pszBuffer = HeapAlloc(GetProcessHeap(),
-                          HEAP_ZERO_MEMORY,
-                          ulLength);
-    if (pszBuffer == NULL)
-        return;
-
-    ret = CM_Get_Device_ID_List_ExW(dap->szDeviceID,
-                                    pszBuffer,
-                                    ulLength,
-                                    ulFlags,
-                                    NULL);
-    if (ret != CR_SUCCESS)
-    {
-        HeapFree(GetProcessHeap(), 0, pszBuffer);
-        return;
-    }
-
-    pszStr = pszBuffer;
-    index = 0;
-    while (*pszStr != 0)
-    {
-        len = wcslen(pszStr) + 1;
-
-        SetListViewText(hwndListView, index, pszStr);
-
-        pszStr += len;
-        index++;
-    }
-
-    HeapFree(GetProcessHeap(), 0, pszBuffer);
-}
-
-
-static VOID
-DisplayDeviceProperties(IN PDEVADVPROP_INFO dap,
-                        IN HWND hwndComboBox,
-                        IN HWND hwndListView)
-{
-    INT Index;
-
-    Index = (INT)SendMessage(hwndComboBox,
-                             CB_GETCURSEL,
-                             0,
-                             0);
-    if (Index == CB_ERR)
-        return;
-
-    (void)ListView_DeleteAllItems(hwndListView);
-
-    switch (Index)
-    {
-        case 0:
-            SetListViewText(hwndListView, 0, dap->szDeviceID);
-            break;
-
-        case 1: /* Hardware ID */
-            DisplayDevicePropertyText(dap,
-                                      hwndListView,
-                                      SPDRP_HARDWAREID);
-            break;
-
-        case 2: /* Compatible IDs */
-            DisplayDevicePropertyText(dap,
-                                      hwndListView,
-                                      SPDRP_COMPATIBLEIDS);
-            break;
-
-        case 3: /* Matching ID */
-            DisplayMatchingDeviceId(dap,
-                                    hwndListView);
-            break;
-
-        case 4: /* Service */
-            DisplayDevicePropertyText(dap,
-                                      hwndListView,
-                                      SPDRP_SERVICE);
-            break;
-
-        case 5: /* Enumerator */
-            DisplayDevNodeEnumerator(dap,
-                                     hwndListView);
-            break;
-
-        case 6: /* Capabilities */
-            DisplayDevicePropertyText(dap,
-                                      hwndListView,
-                                      SPDRP_CAPABILITIES);
-            break;
-
-        case 7: /* Devnode Flags */
-            DisplayDevNodeFlags(dap,
-                                hwndListView);
-            break;
-
-        case 8: /* Config Flags */
-            DisplayDevicePropertyText(dap,
-                                      hwndListView,
-                                      SPDRP_CONFIGFLAGS);
-            break;
-
-        case 9: /* CSConfig Flags */
-            DisplayCsFlags(dap,
-                           hwndListView);
-            break;
-
-        case 10: /* Ejection relation */
-            DisplayDeviceRelations(dap,
-                                   hwndListView,
-                                   CM_GETIDLIST_FILTER_EJECTRELATIONS);
-            break;
-
-        case 11: /* Removal relations */
-            DisplayDeviceRelations(dap,
-                                   hwndListView,
-                                   CM_GETIDLIST_FILTER_REMOVALRELATIONS);
-            break;
-
-        case 12: /* Bus relation */
-            DisplayDeviceRelations(dap,
-                                   hwndListView,
-                                   CM_GETIDLIST_FILTER_BUSRELATIONS);
-            break;
-
-        case 13: /* Device Upper Filters */
-            DisplayDevicePropertyText(dap,
-                                      hwndListView,
-                                      SPDRP_UPPERFILTERS);
-            break;
-
-        case 14: /* Device Lower Filters */
-            DisplayDevicePropertyText(dap,
-                                      hwndListView,
-                                      SPDRP_LOWERFILTERS);
-            break;
-
-        case 15: /* Class Upper Filters */
-            DisplayClassProperties(dap,
-                                   hwndListView,
-                                   L"UpperFilters");
-            break;
-
-        case 16: /* Class Lower Filters */
-            DisplayClassProperties(dap,
-                                   hwndListView,
-                                   L"LowerFilters");
-            break;
-
-        case 17: /* Class Installer */
-            DisplayClassProperties(dap,
-                                   hwndListView,
-                                   L"Installer32");
-            break;
-
-        case 18: /* Class Coinstaller */
-            DisplayClassCoinstallers(dap,
-                                     hwndListView);
-            break;
-
-        case 19: /* Device Coinstaller */
-            DisplayDeviceCoinstallers(dap,
-                                      hwndListView);
-            break;
-
-#if 0
-        case 20: /* Firmware Revision */
-            break;
-
-        case 21: /* Current Power State */
-            break;
-
-        case 20: /* Power Capabilities */
-            break;
-
-        case 21: /* Power State Mappings */
-            break;
-#endif
-
-        default:
-            SetListViewText(hwndListView, 0, L"<Not implemented yet>");
-            break;
-    }
-}
-
-
-static INT_PTR
-CALLBACK
-AdvProcDetailsDlgProc(IN HWND hwndDlg,
-                      IN UINT uMsg,
-                      IN WPARAM wParam,
-                      IN LPARAM lParam)
-{
-    PDEVADVPROP_INFO dap;
-    INT_PTR Ret = FALSE;
-
-    dap = (PDEVADVPROP_INFO)GetWindowLongPtr(hwndDlg,
-                                             DWL_USER);
-
-    if (dap != NULL || uMsg == WM_INITDIALOG)
-    {
-        switch (uMsg)
-        {
-            case WM_COMMAND:
-            {
-                switch (LOWORD(wParam))
-                {
-                    case IDC_DETAILSPROPNAME:
-                        if (HIWORD(wParam) == CBN_SELCHANGE)
-                        {
-                            DisplayDeviceProperties(dap,
-                                                    GetDlgItem(hwndDlg, IDC_DETAILSPROPNAME),
-                                                    GetDlgItem(hwndDlg, IDC_DETAILSPROPVALUE));
-                        }
-                        break;
-                }
-                break;
-            }
-
-            case WM_NOTIFY:
-            {
-                NMHDR *hdr = (NMHDR*)lParam;
-                switch (hdr->code)
-                {
-                    case PSN_APPLY:
-                        break;
-                }
-                break;
-            }
-
-            case WM_INITDIALOG:
-            {
-                dap = (PDEVADVPROP_INFO)((LPPROPSHEETPAGE)lParam)->lParam;
-                if (dap != NULL)
-                {
-                    SetWindowLongPtr(hwndDlg,
-                                     DWL_USER,
-                                     (DWORD_PTR)dap);
-
-                    UpdateDetailsDlg(hwndDlg,
-                                     dap);
-                }
-                Ret = TRUE;
-                break;
-            }
-        }
-    }
-
-    return Ret;
-}
-
-
-static VOID
-InitDevUsageActions(IN HWND hwndDlg,
-                    IN HWND hComboBox,
-                    IN PDEVADVPROP_INFO dap)
-{
-    INT Index;
-    UINT i;
-    UINT Actions[] =
-    {
-        IDS_ENABLEDEVICE,
-        IDS_DISABLEDEVICE,
-    };
-
-    for (i = 0;
-         i != sizeof(Actions) / sizeof(Actions[0]);
-         i++)
-    {
-        /* fill in the device usage combo box */
-        if (LoadString(hDllInstance,
-                       Actions[i],
-                       dap->szTemp,
-                       sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
-        {
-            Index = (INT)SendMessage(hComboBox,
-                                     CB_ADDSTRING,
-                                     0,
-                                     (LPARAM)dap->szTemp);
-            if (Index != CB_ERR)
-            {
-                SendMessage(hComboBox,
-                            CB_SETITEMDATA,
-                            (WPARAM)Index,
-                            (LPARAM)Actions[i]);
-
-                switch (Actions[i])
-                {
-                    case IDS_ENABLEDEVICE:
-                        if (dap->DeviceStarted)
-                        {
-                            SendMessage(hComboBox,
-                                        CB_SETCURSEL,
-                                        (WPARAM)Index,
-                                        0);
-                        }
-                        break;
-
-                    case IDS_DISABLEDEVICE:
-                        if (!dap->DeviceStarted)
-                        {
-                            SendMessage(hComboBox,
-                                        CB_SETCURSEL,
-                                        (WPARAM)Index,
-                                        0);
-                        }
-                        break;
-
-                    default:
-                        break;
-                }
-            }
-        }
-    }
-}
-
-
-static UINT
-GetSelectedUsageAction(IN HWND hComboBox)
-{
-    INT Index;
-    UINT Ret = 0;
-
-    Index = (INT)SendMessage(hComboBox,
-                             CB_GETCURSEL,
-                             0,
-                             0);
-    if (Index != CB_ERR)
-    {
-        INT iRet = (INT) SendMessage(hComboBox,
-                               CB_GETITEMDATA,
-                               (WPARAM)Index,
-                               0);
-        if (iRet != CB_ERR)
-        {
-            Ret = (UINT)iRet;
-        }
-    }
-
-    return Ret;
-}
-
-
-static BOOL
-ApplyGeneralSettings(IN HWND hwndDlg,
-                     IN PDEVADVPROP_INFO dap)
-{
-    BOOL Ret = FALSE;
-
-    if (dap->DeviceUsageChanged && dap->IsAdmin && dap->CanDisable)
-    {
-        UINT SelectedUsageAction;
-        BOOL NeedReboot = FALSE;
-
-        SelectedUsageAction = GetSelectedUsageAction(GetDlgItem(hwndDlg,
-                                                                IDC_DEVUSAGE));
-        switch (SelectedUsageAction)
-        {
-            case IDS_ENABLEDEVICE:
-                if (!dap->DeviceStarted)
-                {
-                    Ret = EnableDevice(dap->DeviceInfoSet,
-                                       &dap->DeviceInfoData,
-                                       TRUE,
-                                       0,
-                                       &NeedReboot);
-                }
-                break;
-
-            case IDS_DISABLEDEVICE:
-                if (dap->DeviceStarted)
-                {
-                    Ret = EnableDevice(dap->DeviceInfoSet,
-                                       &dap->DeviceInfoData,
-                                       FALSE,
-                                       0,
-                                       &NeedReboot);
-                }
-                break;
-
-            default:
-                break;
-        }
-
-        if (Ret)
-        {
-            if (NeedReboot)
-            {
-                /* make PropertySheet() return PSM_REBOOTSYSTEM */
-                PropSheet_RebootSystem(hwndDlg);
-            }
-        }
-        else
-        {
-            /* FIXME - display an error message */
-            FIXME("Failed to enable/disable device! LastError: %d\n",
-                  GetLastError());
-        }
-    }
-    else
-        Ret = !dap->DeviceUsageChanged;
-
-    /* disable the apply button */
-    PropSheet_UnChanged(GetParent(hwndDlg),
-                        hwndDlg);
-    dap->DeviceUsageChanged = FALSE;
-    return Ret;
-}
-
-
-static VOID
-UpdateDevInfo(IN HWND hwndDlg,
-              IN PDEVADVPROP_INFO dap,
-              IN BOOL ReOpen)
-{
-    HWND hDevUsage, hPropSheetDlg, hDevProbBtn;
-    CONFIGRET cr;
-    ULONG Status, ProblemNumber;
-    SP_DEVINSTALL_PARAMS_W InstallParams;
-    UINT TroubleShootStrId = IDS_TROUBLESHOOTDEV;
-    BOOL bFlag, bDevActionAvailable = TRUE;
-    BOOL bDrvInstalled = FALSE;
-    DWORD iPage;
-    HDEVINFO DeviceInfoSet = NULL;
-    PSP_DEVINFO_DATA DeviceInfoData = NULL;
-    PROPSHEETHEADER psh;
-    DWORD nDriverPages = 0;
-    BOOL RecalcPages = FALSE;
-
-    TRACE("UpdateDevInfo()\n");
-
-    hPropSheetDlg = GetParent(hwndDlg);
-
-    if (dap->PageInitialized)
-    {
-        /* switch to the General page */
-        PropSheet_SetCurSelByID(hPropSheetDlg,
-                                IDD_DEVICEGENERAL);
-
-        /* remove and destroy the existing device property sheet pages */
-        if (dap->DevPropSheets != NULL)
-        {
-            for (iPage = 0;
-                 iPage != dap->nDevPropSheets;
-                 iPage++)
-            {
-                if (dap->DevPropSheets[iPage] != NULL)
-                {
-                    PropSheet_RemovePage(hPropSheetDlg,
-                                         (WPARAM) -1,
-                                         dap->DevPropSheets[iPage]);
-                    RecalcPages = TRUE;
-                }
-            }
-        }
-    }
-
-    iPage = 0;
-
-    if (dap->FreeDevPropSheets)
-    {
-        /* don't free the array if it's the one allocated in
-           DisplayDeviceAdvancedProperties */
-        HeapFree(GetProcessHeap(),
-                 0,
-                 dap->DevPropSheets);
-
-        dap->FreeDevPropSheets = FALSE;
-    }
-
-    dap->DevPropSheets = NULL;
-    dap->nDevPropSheets = 0;
-
-    if (ReOpen)
-    {
-        /* create a new device info set and re-open the device */
-        if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
-        {
-            SetupDiDestroyDeviceInfoList(dap->CurrentDeviceInfoSet);
-        }
-
-        dap->ParentDevInst = 0;
-        dap->CurrentDeviceInfoSet = SetupDiCreateDeviceInfoListEx(NULL,
-                                                                  hwndDlg,
-                                                                  dap->lpMachineName,
-                                                                  NULL);
-        if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
-        {
-            if (SetupDiOpenDeviceInfo(dap->CurrentDeviceInfoSet,
-                                      dap->szDeviceID,
-                                      hwndDlg,
-                                      0,
-                                      &dap->CurrentDeviceInfoData))
-            {
-                if (dap->CloseDevInst)
-                {
-                    SetupDiDestroyDeviceInfoList(dap->DeviceInfoSet);
-                }
-
-                dap->CloseDevInst = TRUE;
-                dap->DeviceInfoSet = dap->CurrentDeviceInfoSet;
-                dap->DeviceInfoData = dap->CurrentDeviceInfoData;
-                dap->CurrentDeviceInfoSet = INVALID_HANDLE_VALUE;
-            }
-            else
-                goto GetParentNode;
-        }
-        else
-        {
-GetParentNode:
-            /* get the parent node from the initial devinst */
-            CM_Get_Parent_Ex(&dap->ParentDevInst,
-                             dap->DeviceInfoData.DevInst,
-                             0,
-                             dap->hMachine);
-        }
-
-        if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
-        {
-            DeviceInfoSet = dap->CurrentDeviceInfoSet;
-            DeviceInfoData = &dap->CurrentDeviceInfoData;
-        }
-        else
-        {
-            DeviceInfoSet = dap->DeviceInfoSet;
-            DeviceInfoData = &dap->DeviceInfoData;
-        }
-    }
-    else
-    {
-        DeviceInfoSet = dap->DeviceInfoSet;
-        DeviceInfoData = &dap->DeviceInfoData;
-    }
-
-    dap->HasDriverPage = FALSE;
-    dap->HasResourcePage = FALSE;
-    dap->HasPowerPage = FALSE;
-    if (IsDriverInstalled(DeviceInfoData->DevInst,
-                          dap->hMachine,
-                          &bDrvInstalled) &&
-        bDrvInstalled)
-    {
-        if (SetupDiCallClassInstaller((dap->ShowRemotePages ?
-                                           DIF_ADDREMOTEPROPERTYPAGE_ADVANCED :
-                                           DIF_ADDPROPERTYPAGE_ADVANCED),
-                                      DeviceInfoSet,
-                                      DeviceInfoData))
-        {
-            /* get install params */
-            InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
-            if (!SetupDiGetDeviceInstallParamsW(DeviceInfoSet,
-                                                DeviceInfoData,
-                                                &InstallParams))
-            {
-                /* zero the flags */
-                InstallParams.Flags = 0;
-            }
-
-            dap->HasDriverPage = !(InstallParams.Flags & DI_DRIVERPAGE_ADDED);
-            dap->HasResourcePage = !(InstallParams.Flags & DI_RESOURCEPAGE_ADDED);
-            dap->HasPowerPage = !(InstallParams.Flags & DI_FLAGSEX_POWERPAGE_ADDED);
-        }
-    }
-
-    /* get the device icon */
-    if (dap->hDevIcon != NULL)
-    {
-        DestroyIcon(dap->hDevIcon);
-        dap->hDevIcon = NULL;
-    }
-    if (!SetupDiLoadClassIcon(&DeviceInfoData->ClassGuid,
-                              &dap->hDevIcon,
-                              NULL))
-    {
-        dap->hDevIcon = NULL;
-    }
-
-    /* get the device name */
-    if (GetDeviceDescriptionString(DeviceInfoSet,
-                                   DeviceInfoData,
-                                   dap->szDevName,
-                                   sizeof(dap->szDevName) / sizeof(dap->szDevName[0])))
-    {
-        PropSheet_SetTitle(hPropSheetDlg,
-                           PSH_PROPTITLE,
-                           dap->szDevName);
-    }
-
-    /* set the device image */
-    SendDlgItemMessage(hwndDlg,
-                       IDC_DEVICON,
-                       STM_SETICON,
-                       (WPARAM)dap->hDevIcon,
-                       0);
-
-    /* set the device name edit control text */
-    SetDlgItemText(hwndDlg,
-                   IDC_DEVNAME,
-                   dap->szDevName);
-
-    /* set the device type edit control text */
-    if (GetDeviceTypeString(DeviceInfoData,
-                            dap->szTemp,
-                            sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
-    {
-        SetDlgItemText(hwndDlg,
-                       IDC_DEVTYPE,
-                       dap->szTemp);
-    }
-
-    /* set the device manufacturer edit control text */
-    if (GetDeviceManufacturerString(DeviceInfoSet,
-                                    DeviceInfoData,
-                                    dap->szTemp,
-                                    sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
-    {
-        SetDlgItemText(hwndDlg,
-                       IDC_DEVMANUFACTURER,
-                       dap->szTemp);
-    }
-
-    /* set the device location edit control text */
-    if (GetDeviceLocationString(DeviceInfoSet,
-                                DeviceInfoData,
-                                dap->ParentDevInst,
-                                dap->szTemp,
-                                sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
-    {
-        SetDlgItemText(hwndDlg,
-                       IDC_DEVLOCATION,
-                       dap->szTemp);
-    }
-
-    /* set the device status edit control text */
-    if (GetDeviceStatusString(DeviceInfoData->DevInst,
-                              dap->hMachine,
-                              dap->szTemp,
-                              sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
-    {
-        SetDlgItemText(hwndDlg,
-                       IDC_DEVSTATUS,
-                       dap->szTemp);
-    }
-
-    /* set the device troubleshoot button text and disable it if necessary */
-    hDevProbBtn = GetDlgItem(hwndDlg,
-                             IDC_DEVPROBLEM);
-    cr = CM_Get_DevNode_Status_Ex(&Status,
-                                  &ProblemNumber,
-                                  DeviceInfoData->DevInst,
-                                  0,
-                                  dap->hMachine);
-    if (cr == CR_SUCCESS && (Status & DN_HAS_PROBLEM))
-    {
-        switch (ProblemNumber)
-        {
-            case CM_PROB_DEVLOADER_FAILED:
-            {
-                /* FIXME - only if it's not a root bus devloader,
-                           disable the button otherwise */
-                TroubleShootStrId = IDS_UPDATEDRV;
-                break;
-            }
-
-            case CM_PROB_OUT_OF_MEMORY:
-            case CM_PROB_ENTRY_IS_WRONG_TYPE:
-            case CM_PROB_LACKED_ARBITRATOR:
-            case CM_PROB_FAILED_START:
-            case CM_PROB_LIAR:
-            case CM_PROB_UNKNOWN_RESOURCE:
-            {
-                TroubleShootStrId = IDS_UPDATEDRV;
-                break;
-            }
-
-            case CM_PROB_BOOT_CONFIG_CONFLICT:
-            case CM_PROB_NORMAL_CONFLICT:
-            case CM_PROB_REENUMERATION:
-            {
-                /* FIXME - Troubleshoot conflict */
-                break;
-            }
-
-            case CM_PROB_FAILED_FILTER:
-            case CM_PROB_REINSTALL:
-            case CM_PROB_FAILED_INSTALL:
-            {
-                TroubleShootStrId = IDS_REINSTALLDRV;
-                break;
-            }
-
-            case CM_PROB_DEVLOADER_NOT_FOUND:
-            {
-                /* FIXME - 4 cases:
-                   1) if it's a missing system devloader:
-                      - disable the button (Reinstall Driver)
-                   2) if it's not a system devloader but still missing:
-                      - Reinstall Driver
-                   3) if it's not a system devloader but the file can be found:
-                      - Update Driver
-                   4) if it's a missing or empty software key
-                      - Update Driver
-                 */
-                break;
-            }
-
-            case CM_PROB_INVALID_DATA:
-            case CM_PROB_PARTIAL_LOG_CONF:
-            case CM_PROB_NO_VALID_LOG_CONF:
-            case CM_PROB_HARDWARE_DISABLED:
-            case CM_PROB_CANT_SHARE_IRQ:
-            case CM_PROB_TRANSLATION_FAILED:
-            case CM_PROB_SYSTEM_SHUTDOWN:
-            case CM_PROB_PHANTOM:
-                bDevActionAvailable = FALSE;
-                break;
-
-            case CM_PROB_NOT_VERIFIED:
-            case CM_PROB_DEVICE_NOT_THERE:
-                /* FIXME - search hardware */
-                break;
-
-            case CM_PROB_NEED_RESTART:
-            case CM_PROB_WILL_BE_REMOVED:
-            case CM_PROB_MOVED:
-            case CM_PROB_TOO_EARLY:
-            case CM_PROB_DISABLED_SERVICE:
-                TroubleShootStrId = IDS_REBOOT;
-                break;
-
-            case CM_PROB_REGISTRY:
-                /* FIXME - check registry? */
-                break;
-
-            case CM_PROB_DISABLED:
-                /* if device was disabled by the user: */
-                TroubleShootStrId = IDS_ENABLEDEV;
-                /* FIXME - otherwise disable button because the device was
-                           disabled by the system*/
-                break;
-
-            case CM_PROB_DEVLOADER_NOT_READY:
-                /* FIXME - if it's a graphics adapter:
-                           - if it's a a secondary adapter and the main adapter
-                             couldn't be found
-                             - disable  button
-                           - else
-                             - Properties
-                         - else
-                           - Update driver
-                 */
-                break;
-
-            case CM_PROB_FAILED_ADD:
-                TroubleShootStrId = IDS_PROPERTIES;
-                break;
-        }
-    }
-
-    if (LoadString(hDllInstance,
-                   TroubleShootStrId,
-                   dap->szTemp,
-                   sizeof(dap->szTemp) / sizeof(dap->szTemp[0])) != 0)
-    {
-        SetWindowText(hDevProbBtn,
-                      dap->szTemp);
-    }
-    EnableWindow(hDevProbBtn,
-                 dap->IsAdmin && bDevActionAvailable);
-
-    /* check if the device can be enabled/disabled */
-    hDevUsage = GetDlgItem(hwndDlg,
-                           IDC_DEVUSAGE);
-
-    dap->CanDisable = FALSE;
-    dap->DeviceStarted = FALSE;
-
-    if (CanDisableDevice(DeviceInfoData->DevInst,
-                         dap->hMachine,
-                         &bFlag))
-    {
-        dap->CanDisable = bFlag;
-    }
-
-    if (IsDeviceStarted(DeviceInfoData->DevInst,
-                        dap->hMachine,
-                        &bFlag))
-    {
-        dap->DeviceStarted = bFlag;
-    }
-
-    /* enable/disable the device usage controls */
-    EnableWindow(GetDlgItem(hwndDlg,
-                            IDC_DEVUSAGELABEL),
-                 dap->CanDisable && dap->IsAdmin);
-    EnableWindow(hDevUsage,
-                 dap->CanDisable && dap->IsAdmin);
-
-    /* clear the combobox */
-    SendMessage(hDevUsage,
-                CB_RESETCONTENT,
-                0,
-                0);
-    if (dap->CanDisable)
-    {
-        InitDevUsageActions(hwndDlg,
-                            hDevUsage,
-                            dap);
-    }
-
-    /* find out how many new device property sheets to add.
-       fake a PROPSHEETHEADER structure, we don't plan to
-       call PropertySheet again!*/
-    psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags = 0;
-    psh.nPages = 0;
-
-    /* get the number of device property sheets for the device */
-    if (!SetupDiGetClassDevPropertySheets(DeviceInfoSet,
-                                          DeviceInfoData,
-                                          &psh,
-                                          0,
-                                          &nDriverPages,
-                                          dap->PropertySheetType) &&
-        nDriverPages != 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
-    {
-TRACE("Count %d additional pages!\n", nDriverPages);
-        dap->nDevPropSheets += nDriverPages;
-    }
-    else
-    {
-        nDriverPages = 0;
-    }
-
-    /* include the driver page */
-    if (dap->HasDriverPage)
-        dap->nDevPropSheets++;
-
-    /* include the details page */
-    if (dap->Extended)
-        dap->nDevPropSheets++;
-
-    if (dap->HasResourcePage)
-        dap->nDevPropSheets++;
-
-    /* add the device property sheets */
-    if (dap->nDevPropSheets != 0)
-    {
-TRACE("Show %d pages!\n", dap->nDevPropSheets);
-        dap->DevPropSheets = HeapAlloc(GetProcessHeap(),
-                                       HEAP_ZERO_MEMORY,
-                                       dap->nDevPropSheets * sizeof(HPROPSHEETPAGE));
-        if (dap->DevPropSheets != NULL)
-        {
-            if (nDriverPages != 0)
-            {
-                psh.phpage = dap->DevPropSheets;
-
-                /* query the device property sheet pages to add */
-                if (SetupDiGetClassDevPropertySheets(DeviceInfoSet,
-                                                     DeviceInfoData,
-                                                     &psh,
-                                                     dap->nDevPropSheets,
-                                                     NULL,
-                                                     dap->PropertySheetType))
-                {
-                    /* add the property sheets */
-                    for (iPage = 0;
-                         iPage < nDriverPages;
-                         iPage++)
-                    {
-TRACE("Add page %d\n", iPage);
-TRACE("Sheet %p\n", dap->DevPropSheets[iPage]);
-
-                        if (PropSheet_AddPage(hPropSheetDlg,
-                                              dap->DevPropSheets[iPage]))
-                        {
-                            RecalcPages = TRUE;
-                        }
-                        else
-                        {
-TRACE("PropSheet_AddPage() failed\n");
-                        }
-                    }
-
-                    dap->FreeDevPropSheets = TRUE;
-                }
-                else
-                {
-TRACE("SetupDiGetClassDevPropertySheets() failed\n");
-                    /* cleanup, we were unable to get the device property sheets */
-                    iPage = nDriverPages;
-                    dap->nDevPropSheets -= nDriverPages;
-                    nDriverPages = 0;
-                }
-            }
-            else
-                iPage = 0;
-
-            /* add the driver page if necessary */
-            if (dap->HasDriverPage)
-            {
-                PROPSHEETPAGE pspDriver = {0};
-                pspDriver.dwSize = sizeof(PROPSHEETPAGE);
-                pspDriver.dwFlags = PSP_DEFAULT;
-                pspDriver.hInstance = hDllInstance;
-                pspDriver.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICEDRIVER);
-                pspDriver.pfnDlgProc = AdvProcDriverDlgProc;
-                pspDriver.lParam = (LPARAM)dap;
-                dap->DevPropSheets[iPage] = dap->pCreatePropertySheetPageW(&pspDriver);
-                if (dap->DevPropSheets[iPage] != NULL)
-                {
-                    if (PropSheet_AddPage(hPropSheetDlg,
-                                          dap->DevPropSheets[iPage]))
-                    {
-                        iPage++;
-                        RecalcPages = TRUE;
-                    }
-                    else
-                    {
-                        dap->pDestroyPropertySheetPage(dap->DevPropSheets[iPage]);
-                        dap->DevPropSheets[iPage] = NULL;
-                    }
-                }
-            }
-
-            if (dap->Extended)
-            {
-                /* Add the details page */
-                PROPSHEETPAGE pspDetails = {0};
-                pspDetails.dwSize = sizeof(PROPSHEETPAGE);
-                pspDetails.dwFlags = PSP_DEFAULT;
-                pspDetails.hInstance = hDllInstance;
-                pspDetails.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICEDETAILS);
-                pspDetails.pfnDlgProc = AdvProcDetailsDlgProc;
-                pspDetails.lParam = (LPARAM)dap;
-                dap->DevPropSheets[iPage] = dap->pCreatePropertySheetPageW(&pspDetails);
-                if (dap->DevPropSheets[iPage] != NULL)
-                {
-                    if (PropSheet_AddPage(hPropSheetDlg,
-                                          dap->DevPropSheets[iPage]))
-                    {
-                        iPage++;
-                        RecalcPages = TRUE;
-                    }
-                    else
-                    {
-                        dap->pDestroyPropertySheetPage(dap->DevPropSheets[iPage]);
-                        dap->DevPropSheets[iPage] = NULL;
-                    }
-                }
-            }
-
-            if (dap->HasResourcePage)
-            {
-                PROPSHEETPAGE pspDriver = {0};
-                pspDriver.dwSize = sizeof(PROPSHEETPAGE);
-                pspDriver.dwFlags = PSP_DEFAULT;
-                pspDriver.hInstance = hDllInstance;
-                pspDriver.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICERESOURCES);
-                pspDriver.pfnDlgProc = ResourcesProcDriverDlgProc;
-                pspDriver.lParam = (LPARAM)dap;
-                dap->DevPropSheets[iPage] = dap->pCreatePropertySheetPageW(&pspDriver);
-                if (dap->DevPropSheets[iPage] != NULL)
-                {
-                    if (PropSheet_AddPage(hPropSheetDlg,
-                                          dap->DevPropSheets[iPage]))
-                    {
-                        iPage++;
-                        RecalcPages = TRUE;
-                    }
-                    else
-                    {
-                        dap->pDestroyPropertySheetPage(dap->DevPropSheets[iPage]);
-                        dap->DevPropSheets[iPage] = NULL;
-                    }
-                }
-            }
-            /* FIXME: Add the power page */
-        }
-        else
-            dap->nDevPropSheets = 0;
-    }
-
-    if (RecalcPages)
-    {
-        PropSheet_RecalcPageSizes(hPropSheetDlg);
-    }
-
-    /* finally, disable the apply button */
-    PropSheet_UnChanged(hPropSheetDlg,
-                        hwndDlg);
-    dap->DeviceUsageChanged = FALSE;
-}
-
-
-static LRESULT
-CALLBACK
-DlgParentSubWndProc(IN HWND hwnd,
-                    IN UINT uMsg,
-                    IN WPARAM wParam,
-                    IN LPARAM lParam)
-{
-    PDEVADVPROP_INFO dap;
-
-    dap = (PDEVADVPROP_INFO)GetProp(hwnd,
-                                    L"DevMgrDevChangeSub");
-    if (dap != NULL)
-    {
-        if (uMsg == WM_DEVICECHANGE && !IsWindowVisible(dap->hWndGeneralPage))
-        {
-            SendMessage(dap->hWndGeneralPage,
-                        WM_DEVICECHANGE,
-                        wParam,
-                        lParam);
-        }
-
-        /* pass the message the the old window proc */
-        return CallWindowProc(dap->ParentOldWndProc,
-                              hwnd,
-                              uMsg,
-                              wParam,
-                              lParam);
-    }
-    else
-    {
-        /* this is not a good idea if the subclassed window was an ansi
-           window, but we failed finding out the previous window proc
-           so we can't use CallWindowProc. This should rarely - if ever -
-           happen. */
-
-        return DefWindowProc(hwnd,
-                             uMsg,
-                             wParam,
-                             lParam);
-    }
-}
-
-
-static INT_PTR
-CALLBACK
-AdvPropGeneralDlgProc(IN HWND hwndDlg,
-                      IN UINT uMsg,
-                      IN WPARAM wParam,
-                      IN LPARAM lParam)
-{
-    PDEVADVPROP_INFO dap;
-    INT_PTR Ret = FALSE;
-
-    dap = (PDEVADVPROP_INFO)GetWindowLongPtr(hwndDlg,
-                                             DWL_USER);
-
-    if (dap != NULL || uMsg == WM_INITDIALOG)
-    {
-        switch (uMsg)
-        {
-            case WM_COMMAND:
-            {
-                switch (LOWORD(wParam))
-                {
-                    case IDC_DEVUSAGE:
-                    {
-                        if (HIWORD(wParam) == CBN_SELCHANGE)
-                        {
-                            PropSheet_Changed(GetParent(hwndDlg),
-                                              hwndDlg);
-                            dap->DeviceUsageChanged = TRUE;
-                        }
-                        break;
-                    }
-
-                    case IDC_DEVPROBLEM:
-                    {
-                        if (dap->IsAdmin)
-                        {
-                            /* display the device problem wizard */
-                            ShowDeviceProblemWizard(hwndDlg,
-                                                    dap->DeviceInfoSet,
-                                                    &dap->DeviceInfoData,
-                                                    dap->hMachine);
-                        }
-                        break;
-                    }
-                }
-                break;
-            }
-
-            case WM_NOTIFY:
-            {
-                NMHDR *hdr = (NMHDR*)lParam;
-                switch (hdr->code)
-                {
-                    case PSN_APPLY:
-                        ApplyGeneralSettings(hwndDlg,
-                                             dap);
-                        break;
-                }
-                break;
-            }
-
-            case WM_INITDIALOG:
-            {
-                dap = (PDEVADVPROP_INFO)((LPPROPSHEETPAGE)lParam)->lParam;
-                if (dap != NULL)
-                {
-                    HWND hWndParent;
-
-                    dap->hWndGeneralPage = hwndDlg;
-
-                    SetWindowLongPtr(hwndDlg,
-                                     DWL_USER,
-                                     (DWORD_PTR)dap);
-
-                    /* subclass the parent window to always receive
-                       WM_DEVICECHANGE messages */
-                    hWndParent = GetParent(hwndDlg);
-                    if (hWndParent != NULL)
-                    {
-                        /* subclass the parent window. This is not safe
-                           if the parent window belongs to another thread! */
-                        dap->ParentOldWndProc = (WNDPROC)SetWindowLongPtr(hWndParent,
-                                                                          GWLP_WNDPROC,
-                                                                          (LONG_PTR)DlgParentSubWndProc);
-
-                        if (dap->ParentOldWndProc != NULL &&
-                            SetProp(hWndParent,
-                                    L"DevMgrDevChangeSub",
-                                    (HANDLE)dap))
-                        {
-                            dap->hWndParent = hWndParent;
-                        }
-                    }
-
-                    /* do not call UpdateDevInfo directly in here because it modifies
-                       the pages of the property sheet! */
-                    PostMessage(hwndDlg,
-                                PM_INITIALIZE,
-                                0,
-                                0);
-                }
-                Ret = TRUE;
-                break;
-            }
-
-            case WM_DEVICECHANGE:
-            {
-                /* FIXME - don't call UpdateDevInfo for all events */
-                UpdateDevInfo(hwndDlg,
-                              dap,
-                              TRUE);
-                Ret = TRUE;
-                break;
-            }
-
-            case PM_INITIALIZE:
-            {
-                UpdateDevInfo(hwndDlg,
-                              dap,
-                              FALSE);
-                dap->PageInitialized = TRUE;
-                break;
-            }
-
-            case WM_DESTROY:
-            {
-                /* restore the old window proc of the subclassed parent window */
-                if (dap->hWndParent != NULL && dap->ParentOldWndProc != NULL)
-                {
-                    if (SetWindowLongPtr(dap->hWndParent,
-                                         GWLP_WNDPROC,
-                                         (LONG_PTR)dap->ParentOldWndProc) == (LONG_PTR)DlgParentSubWndProc)
-                    {
-                        RemoveProp(dap->hWndParent,
-                                   L"DevMgrDevChangeSub");
-                    }
-                }
-                break;
-            }
-        }
-    }
-
-    return Ret;
-}
-
-
-INT_PTR
-DisplayDeviceAdvancedProperties(IN HWND hWndParent,
-                                IN LPCWSTR lpDeviceID  OPTIONAL,
-                                IN HDEVINFO DeviceInfoSet,
-                                IN PSP_DEVINFO_DATA DeviceInfoData,
-                                IN HINSTANCE hComCtl32,
-                                IN LPCWSTR lpMachineName,
-                                IN DWORD dwFlags)
-{
-    PROPSHEETHEADER psh = {0};
-    PROPSHEETPAGE pspGeneral = {0};
-    PPROPERTYSHEETW pPropertySheetW;
-    PCREATEPROPERTYSHEETPAGEW pCreatePropertySheetPageW;
-    PDESTROYPROPERTYSHEETPAGE pDestroyPropertySheetPage;
-    PDEVADVPROP_INFO DevAdvPropInfo;
-    HMACHINE hMachine = NULL;
-    DWORD DevIdSize = 0;
-    INT_PTR Ret = -1;
-
-    /* we don't want to statically link against comctl32, so find the
-       functions we need dynamically */
-    pPropertySheetW =
-        (PPROPERTYSHEETW)GetProcAddress(hComCtl32,
-                                        "PropertySheetW");
-    pCreatePropertySheetPageW =
-        (PCREATEPROPERTYSHEETPAGEW)GetProcAddress(hComCtl32,
-                                                  "CreatePropertySheetPageW");
-    pDestroyPropertySheetPage =
-        (PDESTROYPROPERTYSHEETPAGE)GetProcAddress(hComCtl32,
-                                                  "DestroyPropertySheetPage");
-    if (pPropertySheetW == NULL ||
-        pCreatePropertySheetPageW == NULL ||
-        pDestroyPropertySheetPage == NULL)
-    {
-        return -1;
-    }
-
-    if (lpDeviceID == NULL)
-    {
-        /* find out how much size is needed for the device id */
-        if (SetupDiGetDeviceInstanceId(DeviceInfoSet,
-                                       DeviceInfoData,
-                                       NULL,
-                                       0,
-                                       &DevIdSize))
-        {
-            ERR("SetupDiGetDeviceInstanceId unexpectedly returned TRUE!\n");
-            return -1;
-        }
-
-        if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
-        {
-            return -1;
-        }
-    }
-    else
-    {
-        DevIdSize = (DWORD)wcslen(lpDeviceID) + 1;
-    }
-
-    if (lpMachineName != NULL && lpMachineName[0] != L'\0')
-    {
-        CONFIGRET cr = CM_Connect_Machine(lpMachineName,
-                                          &hMachine);
-        if (cr != CR_SUCCESS)
-        {
-            return -1;
-        }
-    }
-
-    /* create the internal structure associated with the "General",
-       "Driver", ... pages */
-    DevAdvPropInfo = HeapAlloc(GetProcessHeap(),
-                               HEAP_ZERO_MEMORY,
-                               FIELD_OFFSET(DEVADVPROP_INFO,
-                                            szDeviceID) +
-                                   (DevIdSize * sizeof(WCHAR)));
-    if (DevAdvPropInfo == NULL)
-    {
-        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-        goto Cleanup;
-    }
-
-    if (lpDeviceID == NULL)
-    {
-        /* read the device instance id */
-        if (!SetupDiGetDeviceInstanceId(DeviceInfoSet,
-                                        DeviceInfoData,
-                                        DevAdvPropInfo->szDeviceID,
-                                        DevIdSize,
-                                        NULL))
-        {
-            goto Cleanup;
-        }
-    }
-    else
-    {
-        /* copy the device instance id supplied by the caller */
-        wcscpy(DevAdvPropInfo->szDeviceID,
-               lpDeviceID);
-    }
-
-    DevAdvPropInfo->DeviceInfoSet = DeviceInfoSet;
-    DevAdvPropInfo->DeviceInfoData = *DeviceInfoData;
-    DevAdvPropInfo->CurrentDeviceInfoSet = INVALID_HANDLE_VALUE;
-    DevAdvPropInfo->CurrentDeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
-
-    DevAdvPropInfo->ShowRemotePages = (lpMachineName != NULL && lpMachineName[0] != L'\0');
-    DevAdvPropInfo->hMachine = hMachine;
-    DevAdvPropInfo->lpMachineName = lpMachineName;
-    DevAdvPropInfo->szDevName[0] = L'\0';
-    DevAdvPropInfo->hComCtl32 = hComCtl32;
-    DevAdvPropInfo->pCreatePropertySheetPageW = pCreatePropertySheetPageW;
-    DevAdvPropInfo->pDestroyPropertySheetPage = pDestroyPropertySheetPage;
-
-    DevAdvPropInfo->IsAdmin = IsUserAdmin();
-    DevAdvPropInfo->DoDefaultDevAction = ((dwFlags & DPF_DEVICE_STATUS_ACTION) != 0);
-    DevAdvPropInfo->Extended = ((dwFlags & DPF_EXTENDED) != 0);
-
-    psh.dwSize = sizeof(PROPSHEETHEADER);
-    psh.dwFlags = PSH_PROPTITLE | PSH_NOAPPLYNOW;
-    psh.hwndParent = hWndParent;
-    psh.pszCaption = DevAdvPropInfo->szDevName;
-
-    DevAdvPropInfo->PropertySheetType = DevAdvPropInfo->ShowRemotePages ?
-                                            DIGCDP_FLAG_REMOTE_ADVANCED :
-                                            DIGCDP_FLAG_ADVANCED;
-
-    psh.phpage = HeapAlloc(GetProcessHeap(),
-                           HEAP_ZERO_MEMORY,
-                           1 * sizeof(HPROPSHEETPAGE));
-    if (psh.phpage == NULL)
-    {
-        goto Cleanup;
-    }
-
-    /* add the "General" property sheet */
-    pspGeneral.dwSize = sizeof(PROPSHEETPAGE);
-    pspGeneral.dwFlags = PSP_DEFAULT;
-    pspGeneral.hInstance = hDllInstance;
-    pspGeneral.pszTemplate = (LPCWSTR)MAKEINTRESOURCE(IDD_DEVICEGENERAL);
-    pspGeneral.pfnDlgProc = AdvPropGeneralDlgProc;
-    pspGeneral.lParam = (LPARAM)DevAdvPropInfo;
-    psh.phpage[psh.nPages] = pCreatePropertySheetPageW(&pspGeneral);
-    if (psh.phpage[psh.nPages] != NULL)
-    {
-        psh.nPages++;
-    }
-
-    DevAdvPropInfo->nDevPropSheets = psh.nPages;
-
-    if (psh.nPages != 0)
-    {
-        Ret = pPropertySheetW(&psh);
-
-        /* NOTE: no need to destroy the property sheets anymore! */
-    }
-    else
-    {
-        UINT i;
-
-Cleanup:
-        /* in case of failure the property sheets must be destroyed */
-        if (psh.phpage != NULL)
-        {
-            for (i = 0;
-                 i < psh.nPages;
-                 i++)
-            {
-                if (psh.phpage[i] != NULL)
-                {
-                    pDestroyPropertySheetPage(psh.phpage[i]);
-                }
-            }
-        }
-    }
-
-    if (DevAdvPropInfo != NULL)
-    {
-        if (DevAdvPropInfo->FreeDevPropSheets)
-        {
-            /* don't free the array if it's the one allocated in
-               DisplayDeviceAdvancedProperties */
-            HeapFree(GetProcessHeap(),
-                     0,
-                     DevAdvPropInfo->DevPropSheets);
-        }
-
-        if (DevAdvPropInfo->CloseDevInst)
-        {
-            /* close the device info set in case a new one was created */
-            SetupDiDestroyDeviceInfoList(DevAdvPropInfo->DeviceInfoSet);
-        }
-
-        if (DevAdvPropInfo->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
-        {
-            SetupDiDestroyDeviceInfoList(DevAdvPropInfo->CurrentDeviceInfoSet);
-        }
-
-        if (DevAdvPropInfo->hDevIcon != NULL)
-        {
-            DestroyIcon(DevAdvPropInfo->hDevIcon);
-        }
-
-        HeapFree(GetProcessHeap(),
-                 0,
-                 DevAdvPropInfo);
-    }
-
-    if (psh.phpage != NULL)
-    {
-        HeapFree(GetProcessHeap(),
-                 0,
-                 psh.phpage);
-    }
-
-    if (hMachine != NULL)
-    {
-        CM_Disconnect_Machine(hMachine);
-    }
-
-    return Ret;
-}
-
-
-static BOOL
-GetDeviceAndComputerName(LPWSTR lpString,
-                         WCHAR szDeviceID[],
-                         WCHAR szMachineName[])
-{
-    BOOL ret = FALSE;
-
-    szDeviceID[0] = L'\0';
-    szMachineName[0] = L'\0';
-
-    while (*lpString != L'\0')
-    {
-        if (*lpString == L'/')
-        {
-            lpString++;
-            if(!_wcsnicmp(lpString, L"DeviceID", 8))
-            {
-                lpString += 9;
-                if (*lpString != L'\0')
-                {
-                    int i = 0;
-                    while ((*lpString != L' ') &&
-                           (*lpString != L'\0') &&
-                           (i <= MAX_DEVICE_ID_LEN))
-                    {
-                        szDeviceID[i++] = *lpString++;
-                    }
-                    szDeviceID[i] = L'\0';
-                    ret = TRUE;
-                }
-            }
-            else if (!_wcsnicmp(lpString, L"MachineName", 11))
-            {
-                lpString += 12;
-                if (*lpString != L'\0')
-                {
-                    int i = 0;
-                    while ((*lpString != L' ') &&
-                           (*lpString != L'\0') &&
-                           (i <= MAX_COMPUTERNAME_LENGTH))
-                    {
-                        szMachineName[i++] = *lpString++;
-                    }
-                    szMachineName[i] = L'\0';
-                }
-            }
-            /* knock the pointer back one and let the next
-             * pointer deal with incrementing, otherwise we
-             * go past the end of the string */
-             lpString--;
-        }
-        lpString++;
-    }
-
-    return ret;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceAdvancedPropertiesW
- *
- * DESCRIPTION
- *   Invokes the device properties dialog, this version may add some property pages
- *   for some devices
- *
- * ARGUMENTS
- *   hWndParent:    Handle to the parent window
- *   lpMachineName: Machine Name, NULL is the local machine
- *   lpDeviceID:    Specifies the device whose properties are to be shown
- *
- * RETURN VALUE
- *   Always returns -1, a call to GetLastError returns 0 if successful
- *
- * @implemented
- */
-INT_PTR
-WINAPI
-DeviceAdvancedPropertiesW(IN HWND hWndParent  OPTIONAL,
-                          IN LPCWSTR lpMachineName  OPTIONAL,
-                          IN LPCWSTR lpDeviceID)
-{
-    HDEVINFO hDevInfo;
-    SP_DEVINFO_DATA DevInfoData;
-    HINSTANCE hComCtl32;
-    INT_PTR Ret = -1;
-
-    if (lpDeviceID == NULL)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return FALSE;
-    }
-
-    /* dynamically load comctl32 */
-    hComCtl32 = LoadAndInitComctl32();
-    if (hComCtl32 != NULL)
-    {
-        hDevInfo = SetupDiCreateDeviceInfoListEx(NULL,
-                                                 hWndParent,
-                                                 lpMachineName,
-                                                 NULL);
-        if (hDevInfo != INVALID_HANDLE_VALUE)
-        {
-            DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
-            if (SetupDiOpenDeviceInfo(hDevInfo,
-                                      lpDeviceID,
-                                      hWndParent,
-                                      0,
-                                      &DevInfoData))
-            {
-                Ret = DisplayDeviceAdvancedProperties(hWndParent,
-                                                      lpDeviceID,
-                                                      hDevInfo,
-                                                      &DevInfoData,
-                                                      hComCtl32,
-                                                      lpMachineName,
-                                                      0);
-            }
-
-            SetupDiDestroyDeviceInfoList(hDevInfo);
-        }
-
-        FreeLibrary(hComCtl32);
-    }
-
-    return Ret;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceAdvancedPropertiesA
- *
- * DESCRIPTION
- *   Invokes the device properties dialog, this version may add some property pages
- *   for some devices
- *
- * ARGUMENTS
- *   hWndParent:    Handle to the parent window
- *   lpMachineName: Machine Name, NULL is the local machine
- *   lpDeviceID:    Specifies the device whose properties are to be shown
- *
- * RETURN VALUE
- *   Always returns -1, a call to GetLastError returns 0 if successful
- *
- * @implemented
- */
-INT_PTR
-WINAPI
-DeviceAdvancedPropertiesA(IN HWND hWndParent  OPTIONAL,
-                          IN LPCSTR lpMachineName  OPTIONAL,
-                          IN LPCSTR lpDeviceID)
-{
-    LPWSTR lpMachineNameW = NULL;
-    LPWSTR lpDeviceIDW = NULL;
-    INT_PTR Ret = -1;
-
-    if (lpMachineName != NULL)
-    {
-        if (!(lpMachineNameW = ConvertMultiByteToUnicode(lpMachineName,
-                                                         CP_ACP)))
-        {
-            goto Cleanup;
-        }
-    }
-    if (lpDeviceID != NULL)
-    {
-        if (!(lpDeviceIDW = ConvertMultiByteToUnicode(lpDeviceID,
-                                                      CP_ACP)))
-        {
-            goto Cleanup;
-        }
-    }
-
-    Ret = DeviceAdvancedPropertiesW(hWndParent,
-                                    lpMachineNameW,
-                                    lpDeviceIDW);
-
-Cleanup:
-    if (lpMachineNameW != NULL)
-    {
-        HeapFree(GetProcessHeap(),
-                 0,
-                 lpMachineNameW);
-    }
-    if (lpDeviceIDW != NULL)
-    {
-        HeapFree(GetProcessHeap(),
-                 0,
-                 lpDeviceIDW);
-    }
-
-    return Ret;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DevicePropertiesExA
- *
- * DESCRIPTION
- *   Invokes the extended device properties dialog
- *
- * ARGUMENTS
- *   hWndParent:    Handle to the parent window
- *   lpMachineName: Machine Name, NULL is the local machine
- *   lpDeviceID:    Specifies the device whose properties are to be shown, optional if
- *                  bShowDevMgr is nonzero
- *   dwFlags:       This parameter can be a combination of the following flags:
- *                  * DPF_DEVICE_STATUS_ACTION: Only valid if bShowDevMgr, causes
- *                                              the default device status action button
- *                                              to be clicked (Troubleshoot, Enable
- *                                              Device, etc)
- *   bShowDevMgr:   If non-zero it displays the device manager instead of
- *                  the advanced device property dialog
- *
- * RETURN VALUE
- *   1:  if bShowDevMgr is non-zero and no error occured
- *   -1: a call to GetLastError returns 0 if successful
- *
- * @implemented
- */
-INT_PTR
-WINAPI
-DevicePropertiesExA(IN HWND hWndParent  OPTIONAL,
-                    IN LPCSTR lpMachineName  OPTIONAL,
-                    IN LPCSTR lpDeviceID  OPTIONAL,
-                    IN DWORD dwFlags  OPTIONAL,
-                    IN BOOL bShowDevMgr)
-{
-    LPWSTR lpMachineNameW = NULL;
-    LPWSTR lpDeviceIDW = NULL;
-    INT_PTR Ret = -1;
-
-    if (lpMachineName != NULL)
-    {
-        if (!(lpMachineNameW = ConvertMultiByteToUnicode(lpMachineName,
-                                                         CP_ACP)))
-        {
-            goto Cleanup;
-        }
-    }
-    if (lpDeviceID != NULL)
-    {
-        if (!(lpDeviceIDW = ConvertMultiByteToUnicode(lpDeviceID,
-                                                      CP_ACP)))
-        {
-            goto Cleanup;
-        }
-    }
-
-    Ret = DevicePropertiesExW(hWndParent,
-                              lpMachineNameW,
-                              lpDeviceIDW,
-                              dwFlags,
-                              bShowDevMgr);
-
-Cleanup:
-    if (lpMachineNameW != NULL)
-    {
-        HeapFree(GetProcessHeap(),
-                 0,
-                 lpMachineNameW);
-    }
-    if (lpDeviceIDW != NULL)
-    {
-        HeapFree(GetProcessHeap(),
-                 0,
-                 lpDeviceIDW);
-    }
-
-    return Ret;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DevicePropertiesExW
- *
- * DESCRIPTION
- *   Invokes the extended device properties dialog
- *
- * ARGUMENTS
- *   hWndParent:    Handle to the parent window
- *   lpMachineName: Machine Name, NULL is the local machine
- *   lpDeviceID:    Specifies the device whose properties are to be shown, optional if
- *                  bShowDevMgr is nonzero
- *   dwFlags:       This parameter can be a combination of the following flags:
- *                  * DPF_DEVICE_STATUS_ACTION: Only valid if bShowDevMgr, causes
- *                                              the default device status action button
- *                                              to be clicked (Troubleshoot, Enable
- *                                              Device, etc)
- *   bShowDevMgr:   If non-zero it displays the device manager instead of
- *                  the advanced device property dialog
- *
- * RETURN VALUE
- *   1:  if bShowDevMgr is non-zero and no error occured
- *   -1: a call to GetLastError returns 0 if successful
- *
- * @implemented
- */
-INT_PTR
-WINAPI
-DevicePropertiesExW(IN HWND hWndParent  OPTIONAL,
-                    IN LPCWSTR lpMachineName  OPTIONAL,
-                    IN LPCWSTR lpDeviceID  OPTIONAL,
-                    IN DWORD dwFlags  OPTIONAL,
-                    IN BOOL bShowDevMgr)
-{
-    INT_PTR Ret = -1;
-
-    if (dwFlags & ~(DPF_EXTENDED | DPF_DEVICE_STATUS_ACTION))
-    {
-        FIXME("DevPropertiesExW: Invalid flags: 0x%x\n",
-                dwFlags & ~(DPF_EXTENDED | DPF_DEVICE_STATUS_ACTION));
-        SetLastError(ERROR_INVALID_FLAGS);
-        return -1;
-    }
-
-    if (bShowDevMgr)
-    {
-        FIXME("DevPropertiesExW doesn't support bShowDevMgr!\n");
-        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    }
-    else
-    {
-        HDEVINFO hDevInfo;
-        SP_DEVINFO_DATA DevInfoData;
-        HINSTANCE hComCtl32;
-
-        if (lpDeviceID == NULL)
-        {
-            SetLastError(ERROR_INVALID_PARAMETER);
-            return -1;
-        }
-
-        /* dynamically load comctl32 */
-        hComCtl32 = LoadAndInitComctl32();
-        if (hComCtl32 != NULL)
-        {
-            hDevInfo = SetupDiCreateDeviceInfoListEx(NULL,
-                                                     hWndParent,
-                                                     lpMachineName,
-                                                     NULL);
-            if (hDevInfo != INVALID_HANDLE_VALUE)
-            {
-                DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
-                if (SetupDiOpenDeviceInfo(hDevInfo,
-                                          lpDeviceID,
-                                          hWndParent,
-                                          0,
-                                          &DevInfoData))
-                {
-                    Ret = DisplayDeviceAdvancedProperties(hWndParent,
-                                                          lpDeviceID,
-                                                          hDevInfo,
-                                                          &DevInfoData,
-                                                          hComCtl32,
-                                                          lpMachineName,
-                                                          dwFlags);
-                }
-
-                SetupDiDestroyDeviceInfoList(hDevInfo);
-            }
-
-            FreeLibrary(hComCtl32);
-        }
-    }
-
-    return Ret;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DevicePropertiesA
- *
- * DESCRIPTION
- *   Invokes the device properties dialog directly
- *
- * ARGUMENTS
- *   hWndParent:    Handle to the parent window
- *   lpMachineName: Machine Name, NULL is the local machine
- *   lpDeviceID:    Specifies the device whose properties are to be shown
- *   bShowDevMgr:   If non-zero it displays the device manager instead of
- *                  the device property dialog
- *
- * RETURN VALUE
- *   >=0: if no errors occured
- *   -1:  if errors occured
- *
- * REVISIONS
- *
- * @implemented
- */
-int
-WINAPI
-DevicePropertiesA(HWND hWndParent,
-                  LPCSTR lpMachineName,
-                  LPCSTR lpDeviceID,
-                  BOOL bShowDevMgr)
-{
-    return DevicePropertiesExA(hWndParent,
-                               lpMachineName,
-                               lpDeviceID,
-                               DPF_EXTENDED,
-                               bShowDevMgr);
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DevicePropertiesW
- *
- * DESCRIPTION
- *   Invokes the device properties dialog directly
- *
- * ARGUMENTS
- *   hWndParent:    Handle to the parent window
- *   lpMachineName: Machine Name, NULL is the local machine
- *   lpDeviceID:    Specifies the device whose properties are to be shown
- *   bShowDevMgr:   If non-zero it displays the device manager instead of
- *                  the device property dialog
- *
- * RETURN VALUE
- *   >=0: if no errors occured
- *   -1:  if errors occured
- *
- * REVISIONS
- *
- * @implemented
- */
-int
-WINAPI
-DevicePropertiesW(HWND hWndParent,
-                  LPCWSTR lpMachineName,
-                  LPCWSTR lpDeviceID,
-                  BOOL bShowDevMgr)
-{
-    return DevicePropertiesExW(hWndParent,
-                               lpMachineName,
-                               lpDeviceID,
-                               DPF_EXTENDED,
-                               bShowDevMgr);
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceProperties_RunDLLA
- *
- * DESCRIPTION
- *   Invokes the device properties dialog
- *
- * ARGUMENTS
- *   hWndParent:  Handle to the parent window
- *   hInst:       Handle to the application instance
- *   lpDeviceCmd: A command that includes the DeviceID of the properties to be shown,
- *                also see NOTEs
- *   nCmdShow:    Specifies how the window should be shown
- *
- * RETURN VALUE
- *
- * REVISIONS
- *
- * NOTE
- *   - lpDeviceCmd is a string in the form of "/MachineName MACHINE /DeviceID DEVICEPATH"
- *     (/MachineName is optional). This function only parses this string and eventually
- *     calls DeviceProperties().
- *
- * @implemented
- */
-VOID
-WINAPI
-DeviceProperties_RunDLLA(HWND hWndParent,
-                         HINSTANCE hInst,
-                         LPCSTR lpDeviceCmd,
-                         int nCmdShow)
-{
-    LPWSTR lpDeviceCmdW = NULL;
-
-    if (lpDeviceCmd != NULL)
-    {
-        if ((lpDeviceCmdW = ConvertMultiByteToUnicode(lpDeviceCmd,
-                                                      CP_ACP)))
-        {
-            DeviceProperties_RunDLLW(hWndParent,
-                                     hInst,
-                                     lpDeviceCmdW,
-                                     nCmdShow);
-        }
-    }
-
-    if (lpDeviceCmdW != NULL)
-    {
-        HeapFree(GetProcessHeap(),
-                 0,
-                 lpDeviceCmdW);
-    }
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceProperties_RunDLLW
- *
- * DESCRIPTION
- *   Invokes the device properties dialog
- *
- * ARGUMENTS
- *   hWndParent:  Handle to the parent window
- *   hInst:       Handle to the application instance
- *   lpDeviceCmd: A command that includes the DeviceID of the properties to be shown,
- *                also see NOTEs
- *   nCmdShow:    Specifies how the window should be shown
- *
- * RETURN VALUE
- *
- * REVISIONS
- *
- * NOTE
- *   - lpDeviceCmd is a string in the form of "/MachineName MACHINE /DeviceID DEVICEPATH"
- *     (/MachineName is optional). This function only parses this string and eventually
- *     calls DeviceProperties().
- *
- * @implemented
- */
-VOID
-WINAPI
-DeviceProperties_RunDLLW(HWND hWndParent,
-                         HINSTANCE hInst,
-                         LPCWSTR lpDeviceCmd,
-                         int nCmdShow)
-{
-    WCHAR szDeviceID[MAX_DEVICE_ID_LEN+1];
-    WCHAR szMachineName[MAX_COMPUTERNAME_LENGTH+1];
-    LPWSTR lpString = (LPWSTR)lpDeviceCmd;
-
-    if (!GetDeviceAndComputerName(lpString,
-                                  szDeviceID,
-                                  szMachineName))
-    {
-        ERR("DeviceProperties_RunDLLW DeviceID: %S, MachineName: %S\n", szDeviceID, szMachineName);
-        return;
-    }
-
-    DevicePropertiesW(hWndParent,
-                      szMachineName,
-                      szDeviceID,
-                      FALSE);
-}
diff --git a/dll/win32/devmgr/devmgmt/Resource.h b/dll/win32/devmgr/devmgmt/Resource.h
deleted file mode 100644 (file)
index f479ce6..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#define IDC_STATIC          -1
-
-#define IDS_APPNAME         10
-
-#define IDI_MAIN_ICON       20
-#define IDB_ROOT_IMAGE      21
-#define IDB_TOOLBAR         22
-
-/* windows */
-#define IDC_TREEVIEW        50
-#define IDC_TOOLBAR         51
-#define IDC_STATUSBAR       52
-#define IDR_MAINMENU        53
-#define IDR_POPUP           54
-
-/* Actions */
-#define IDC_PROPERTIES      100
-#define IDC_SCAN_HARDWARE   101
-#define IDC_ENABLE_DRV      102
-#define IDC_DISABLE_DRV     103
-#define IDC_UPDATE_DRV      104
-#define IDC_UNINSTALL_DRV   105
-#define IDC_ADD_HARDWARE    106
-
-/* Menu items */
-#define IDC_ACTIONMENU      150
-#define IDC_ABOUT           151
-#define IDC_EXIT            152
-
-
-/* view menu */
-#define IDC_DEVBYTYPE       200
-#define IDC_DEVBYCONN       201
-#define IDC_RESBYTYPE       202
-#define IDC_RESBYCONN       203
-#define IDC_SHOWHIDDEN      204
-
-
-/* tooltips */
-#define IDS_TOOLTIP_PROPERTIES  300
-#define IDS_TOOLTIP_SCAN        301
-#define IDS_TOOLTIP_ENABLE      302
-#define IDS_TOOLTIP_DISABLE     303
-#define IDS_TOOLTIP_UPDATE      304
-#define IDS_TOOLTIP_UNINSTALL   305
-
-/* General strings */
-#define IDS_CONFIRM_DISABLE     400
-
-/* Menu strings */
-#define IDS_MENU_UPDATE         500
-#define IDS_MENU_ENABLE         501
-#define IDS_MENU_DISABLE        502
-#define IDS_MENU_UNINSTALL      503
-#define IDS_MENU_SCAN           504
-#define IDS_MENU_ADD            505
-#define IDS_MENU_PROPERTIES     506
-
-
-/* menu hints */
-#define IDS_HINT_BLANK          1000
-#define IDS_HINT_PROPERTIES     1001
-#define IDS_HINT_SCAN           1002
-#define IDS_HINT_ENABLE         1003
-#define IDS_HINT_DISABLE        1004
-#define IDS_HINT_UPDATE         1005
-#define IDS_HINT_UNINSTALL      1006
-#define IDS_HINT_ADD            1007
-#define IDS_HINT_ABOUT          20008
-#define IDS_HINT_EXIT           20009
-
-#define IDS_HINT_DEV_BY_TYPE    20020
-#define IDS_HINT_DEV_BY_CONN    20021
-#define IDS_HINT_RES_BY_TYPE    20022
-#define IDS_HINT_RES_BY_CONN    20023
-#define IDS_HINT_SHOW_HIDDEN    20024
-
-/* system menu hints */
-#define IDS_HINT_SYS_RESTORE    21001
-#define IDS_HINT_SYS_MOVE       21002
-#define IDS_HINT_SYS_SIZE       21003
-#define IDS_HINT_SYS_MINIMIZE   21004
-#define IDS_HINT_SYS_MAXIMIZE   21005
-#define IDS_HINT_SYS_CLOSE      21006
diff --git a/dll/win32/devmgr/devmgmt/lang/de-DE.rc b/dll/win32/devmgr/devmgmt/lang/de-DE.rc
deleted file mode 100644 (file)
index 52335ce..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
-
-IDR_MAINMENU MENU
-BEGIN
-  POPUP "&Datei"
-  BEGIN
-    MENUITEM "&Beenden",                       IDC_EXIT
-  END
-  MENUITEM "Ak&tion"                           IDC_ACTIONMENU
-  POPUP "&Ansicht"
-  BEGIN
-    MENUITEM "Geräte nach &Typ",               IDC_DEVBYTYPE
-    MENUITEM "Geräte nach &Verbindung",        IDC_DEVBYCONN
-    MENUITEM "Ressourcen nac&h Typ",           IDC_RESBYTYPE, GRAYED
-    MENUITEM "Ressourcen nach V&erbindung",    IDC_RESBYCONN, GRAYED
-    MENUITEM SEPARATOR
-    MENUITEM "Ausgeblendete &Geräte anzeigen", IDC_SHOWHIDDEN
-  END
-  POPUP "&Hilfe"
-  BEGIN
-    MENUITEM "&Über",                          IDC_ABOUT
-  END
-END
-
-
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_CONFIRM_DISABLE       "Wenn Sie dieses Gerät deaktivieren, funktioniert es nicht mehr.\r\nSoll das Gerät deaktiviert werden?"
-END
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_MENU_UPDATE           "Treiber aktualisieren"
-  IDS_MENU_ENABLE           "Aktivieren"
-  IDS_MENU_DISABLE          "Deaktivieren"
-  IDS_MENU_UNINSTALL        "Deinstallieren"
-  IDS_MENU_SCAN             "Nach geänderter Hardware suchen"
-  IDS_MENU_ADD              "Hardware hinzufügen"
-  IDS_MENU_PROPERTIES       "Eigenschaften"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_TOOLTIP_PROPERTIES    "Eigenschaften"
-  IDS_TOOLTIP_SCAN          "Nach geänderter Hardware suchen"
-  IDS_TOOLTIP_ENABLE        "Aktivieren"
-  IDS_TOOLTIP_DISABLE       "Deaktivieren"
-  IDS_TOOLTIP_UPDATE        "Treiber aktualisieren"
-  IDS_TOOLTIP_UNINSTALL     "Deinstallieren"
-END
-
-/* Hints */
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_APPNAME           "ReactOS Gerätemanager"
-  IDS_HINT_BLANK        " "
-  IDS_HINT_PROPERTIES   " Öffnet die Eigenschaften des aktuellen Objekts."
-  IDS_HINT_SCAN         " Nach geänderten oder neuen Plug & Play-Geräten suchen."
-  IDS_HINT_ENABLE       " Aktiviert das ausgewählte Gerät."
-  IDS_HINT_DISABLE      " Deaktiviert das ausgewählte Gerät."
-  IDS_HINT_UPDATE       " Startet den Hardwareupdate-Assistent für das ausgewählte Gerät."
-  IDS_HINT_UNINSTALL    " Deinstalliert den Treiber des ausgewählten Geräts."
-  IDS_HINT_ADD          " Fügt ein älteres (nicht Plug and Play) Gerät dem Computer hinzu." 
-  IDS_HINT_ABOUT        " Über ReactOS Gerätemanager."
-  IDS_HINT_EXIT         " Schließt dieses Programm."
-
-  IDS_HINT_DEV_BY_TYPE  " Geräte werden nach Hardwaretyp angezeigt."
-  IDS_HINT_DEV_BY_CONN  " Geräte werden nach Verbindung angezeigt."
-  IDS_HINT_RES_BY_TYPE  " Ressourcen werden nach Typ angezeigt."
-  IDS_HINT_RES_BY_CONN  " Ressourcen werden nach Verbindung angezeigt."
-  IDS_HINT_SHOW_HIDDEN  " Ältere Geräte und bereits nicht mehr installierte Geräte werden angezeigt."
-
-  IDS_HINT_SYS_RESTORE  " Stellt die normale Größe des Fensters wieder her."
-  IDS_HINT_SYS_MOVE     " Bewegt dieses Fenster."
-  IDS_HINT_SYS_SIZE     " Ändert die Größe dieses Fensters."
-  IDS_HINT_SYS_MINIMIZE " Mimimiert dieses Fenster zu einem Symbol."
-  IDS_HINT_SYS_MAXIMIZE " Erweitert dieses Fenster, um den Bildschirm zu füllen."
-  IDS_HINT_SYS_CLOSE    " Schließt dieses Fenster."
-END
diff --git a/dll/win32/devmgr/devmgmt/lang/en-US.rc b/dll/win32/devmgr/devmgmt/lang/en-US.rc
deleted file mode 100644 (file)
index 4a8f138..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-IDR_MAINMENU MENU
-BEGIN
-  POPUP "&File"
-  BEGIN
-    MENUITEM "E&xit",                       IDC_EXIT
-  END
-  MENUITEM "Action"                         IDC_ACTIONMENU
-  POPUP "View"
-  BEGIN
-    MENUITEM "Devices by type",             IDC_DEVBYTYPE
-    MENUITEM "Devices by connection",       IDC_DEVBYCONN
-    MENUITEM "Resources by type",           IDC_RESBYTYPE, GRAYED
-    MENUITEM "Resources by connection",     IDC_RESBYCONN, GRAYED
-    MENUITEM SEPARATOR
-    MENUITEM "Show hidden devices",         IDC_SHOWHIDDEN
-  END
-  POPUP "Help"
-  BEGIN
-    MENUITEM "About",                       IDC_ABOUT
-  END
-END
-
-
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_CONFIRM_DISABLE       "Disabling this device will cause it to stop functioning.\r\nDo you really want to disable it?"
-END
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_MENU_UPDATE           "Update driver software..."
-  IDS_MENU_ENABLE           "Enable"
-  IDS_MENU_DISABLE          "Disable"
-  IDS_MENU_UNINSTALL        "Uninstall"
-  IDS_MENU_SCAN             "Scan for hardware changes"
-  IDS_MENU_ADD              "Add hardware"
-  IDS_MENU_PROPERTIES       "Properties"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_TOOLTIP_PROPERTIES    "Properties"
-  IDS_TOOLTIP_SCAN          "Scan for hardware changes"
-  IDS_TOOLTIP_ENABLE        "Enable"
-  IDS_TOOLTIP_DISABLE       "Disable"
-  IDS_TOOLTIP_UPDATE        "Update Driver Software"
-  IDS_TOOLTIP_UNINSTALL     "Uninstall"
-END
-
-/* Hints */
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_APPNAME           "ReactOS Device Manager"
-  IDS_HINT_BLANK        " "
-  IDS_HINT_PROPERTIES   " Open property dialog for the current selection."
-  IDS_HINT_SCAN         " Scan for changed or new plug and play devices."
-  IDS_HINT_ENABLE       " Enables the selected device."
-  IDS_HINT_DISABLE      " Disables the selected device."
-  IDS_HINT_UPDATE       " Launches the Update Driver Software wizard for the selected device."
-  IDS_HINT_UNINSTALL    " Uninstalls the driver for the selected device."
-  IDS_HINT_ADD          " Adds a legacy (non-Plug and Play) device to the computer." 
-  IDS_HINT_ABOUT        " About ReactOS Device Manager."
-  IDS_HINT_EXIT         " Exits the program."
-
-  IDS_HINT_DEV_BY_TYPE  " Displays devices by hardware type."
-  IDS_HINT_DEV_BY_CONN  " Displays devices by connection."
-  IDS_HINT_RES_BY_TYPE  " Displays resources by type."
-  IDS_HINT_RES_BY_CONN  " Displays resources by connection type."
-  IDS_HINT_SHOW_HIDDEN  " Displays legacy devices and devices that are no longer installed."
-
-  IDS_HINT_SYS_RESTORE  " Restores this window to normal size."
-  IDS_HINT_SYS_MOVE     " Moves this window."
-  IDS_HINT_SYS_SIZE     " Resizes this window."
-  IDS_HINT_SYS_MINIMIZE " Collapses this window to an icon."
-  IDS_HINT_SYS_MAXIMIZE " Expands this window to fill this screen."
-  IDS_HINT_SYS_CLOSE    " Closes this window."
-END
diff --git a/dll/win32/devmgr/devmgmt/lang/ru-RU.rc b/dll/win32/devmgr/devmgmt/lang/ru-RU.rc
deleted file mode 100644 (file)
index a52ab1f..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Russian language resource file by Kudratov Olimjon (olim98@bk.ru) */
-
-LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-  POPUP "&Файл"
-  BEGIN
-    MENUITEM "В&ыход",                                 IDC_EXIT
-  END
-  POPUP "&Действие"
-  BEGIN
-    MENUITEM "Обнов&ить драйвера...",                  IDC_UPDATE_DRV
-    MENUITEM "&Включить устройство",                   IDC_ENABLE_DRV
-    MENUITEM "&Отключить устройство",                  IDC_DISABLE_DRV
-    MENUITEM "&Удалить драйвера",                      IDC_UNINSTALL_DRV
-    MENUITEM SEPARATOR
-    MENUITEM "О&бновить конфигурацию оборудования",    IDC_SCAN_HARDWARE
-    MENUITEM "Добавить &устройство",                   IDC_ADD_HARDWARE, GRAYED
-    MENUITEM SEPARATOR
-    MENUITEM "Сво&йства",                              IDC_PROPERTIES
-  END
-  POPUP "&Вид"
-  BEGIN
-    MENUITEM "&Устройства по типу",                    IDC_DEVBYTYPE
-    MENUITEM "Устройства по под&ключению",             IDC_DEVBYCONN
-    MENUITEM "&Ресурсы по типу",                       IDC_RESBYTYPE, GRAYED
-    MENUITEM "Ресурсы по подк&лючению",                IDC_RESBYCONN, GRAYED
-    MENUITEM SEPARATOR
-    MENUITEM "Показать &скрытые устройства",           IDC_SHOWHIDDEN
-  END
-  POPUP "&Справка"
-  BEGIN
-    MENUITEM "О &программе",                           IDC_ABOUT
-  END
-END
-
-IDR_POPUP MENU
-BEGIN
-  POPUP "popup"
-  BEGIN
-    MENUITEM "Обнов&ить драйвера...",                  IDC_UPDATE_DRV
-    MENUITEM "&Включить устройство",                   IDC_ENABLE_DRV
-    MENUITEM "&Отключить устройство",                  IDC_DISABLE_DRV
-    MENUITEM "&Удалить драйвера",                      IDC_UNINSTALL_DRV
-    MENUITEM SEPARATOR
-    MENUITEM "О&бновить конфигурацию оборудования",    IDC_SCAN_HARDWARE
-    MENUITEM "Добавить &устройство",                   IDC_ADD_HARDWARE, GRAYED
-    MENUITEM SEPARATOR
-    MENUITEM "Сво&йства",                              IDC_PROPERTIES
-  END
-END
-
-
-
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_CONFIRM_DISABLE       "Disabling this device will cause it to stop functioning.\r\nDo you really want to disable it?"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_TOOLTIP_PROPERTIES    "Свойства"
-  IDS_TOOLTIP_SCAN          "Обновить конфигурацию оборудования"
-  IDS_TOOLTIP_ENABLE        "Включить"
-  IDS_TOOLTIP_DISABLE       "Отключить"
-  IDS_TOOLTIP_UPDATE        "Обновить драйвера"
-  IDS_TOOLTIP_UNINSTALL     "Удалить"
-END
-
-/* Hints */
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_APPNAME           "Диспетчер устройств ReactOS"
-  IDS_HINT_BLANK        " "
-  IDS_HINT_PROPERTIES   " Открытие страницы свойств для выделенного объекта."
-  IDS_HINT_SCAN         " Scan for changed or new plug and play devices."
-  IDS_HINT_ENABLE       " Включение выбранного устройства."
-  IDS_HINT_DISABLE      " Отключение выбранного устройства."
-  IDS_HINT_UPDATE       " Launches the Update Driver Software wizard for the selected device."
-  IDS_HINT_UNINSTALL    " Удаление драйвера для выбранного устройства."
-  IDS_HINT_ADD          " Добавить старое (не Plug-and-Play) устройство на этот компьютер." 
-  IDS_HINT_ABOUT        " About ReactOS Device Manager."
-  IDS_HINT_EXIT         " Exits the program."
-
-  IDS_HINT_DEV_BY_TYPE  " Показывает устройства, отсортированные по типу оборудования."
-  IDS_HINT_DEV_BY_CONN  " Показывает устройства, отсортированные по подключению."
-  IDS_HINT_RES_BY_TYPE  " Показывает ресурсы, отсортированные по типу."
-  IDS_HINT_RES_BY_CONN  " Показывает ресурсы, отсортированные по подключению."
-  IDS_HINT_SHOW_HIDDEN  " Показывает удаленные из системы и устаревшие устройства."
-
-  IDS_HINT_SYS_RESTORE  " Restores this window to normal size."
-  IDS_HINT_SYS_MOVE     " Moves this window."
-  IDS_HINT_SYS_SIZE     " Resizes this window."
-  IDS_HINT_SYS_MINIMIZE " Collapses this window to an icon."
-  IDS_HINT_SYS_MAXIMIZE " Expands this window to fill this screen."
-  IDS_HINT_SYS_CLOSE    " Closes this window."
-END
diff --git a/dll/win32/devmgr/devmgmt/lang/tr-TR.rc b/dll/win32/devmgr/devmgmt/lang/tr-TR.rc
deleted file mode 100644 (file)
index a7b1451..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/* TRANSLATOR: 2015 Erdem Ersoy (eersoy93) (erdemersoy@live.com) */
-
-LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
-
-IDR_MAINMENU MENU
-BEGIN
-  POPUP "&Kütük"
-  BEGIN
-    MENUITEM "&Çıkış",                       IDC_EXIT
-  END
-  MENUITEM "&Eylem"
-  POPUP "&Görünüm"
-  BEGIN
-    MENUITEM "&Türe Göre Aygıtlar",          IDC_DEVBYTYPE
-    MENUITEM "&Bağlantıya Göre Aygıtlar",    IDC_DEVBYCONN
-    MENUITEM "T&üre Göre Kaynaklar",         IDC_RESBYTYPE, GRAYED
-    MENUITEM "B&ağlantıya Göre Kaynaklar",   IDC_RESBYCONN, GRAYED
-    MENUITEM SEPARATOR
-    MENUITEM "&Gizli Aygıtları Göster",      IDC_SHOWHIDDEN
-  END
-  POPUP "&Yardım"
-  BEGIN
-    MENUITEM "&Üzerine",                     IDC_ABOUT
-  END
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_CONFIRM_DISABLE       "Bu aygıtı edilginleştirme onun işleyişinin durmasına neden olacak.\r\nOnu edilginleştirmeyi gerçekten istiyor musunuz?"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_MENU_UPDATE           "Sürücü Yazılımını Şimdikileştir..."
-  IDS_MENU_ENABLE           "Etkin"
-  IDS_MENU_DISABLE          "Edilgin"
-  IDS_MENU_UNINSTALL        "Kaldır"
-  IDS_MENU_SCAN             "Donanım Değişiklikleri İçin Tara"
-  IDS_MENU_ADD              "Donanım Ekle"
-  IDS_MENU_PROPERTIES       "Husûsiyetler"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_TOOLTIP_PROPERTIES    "Husûsiyetler"
-  IDS_TOOLTIP_SCAN          "Donanım Değişiklikleri İçin Tara"
-  IDS_TOOLTIP_ENABLE        "Etkinleştir"
-  IDS_TOOLTIP_DISABLE       "Edilginleştir"
-  IDS_TOOLTIP_UPDATE        "Sürücü Yazılmını Şimdikileştir"
-  IDS_TOOLTIP_UNINSTALL     "Kaldır"
-END
-
-/* Hints */
-STRINGTABLE DISCARDABLE
-BEGIN
-  IDS_APPNAME           "Aygıt Yöneticisi"
-  IDS_HINT_BLANK        " "
-  IDS_HINT_PROPERTIES   " Şimdiki seçilen için husûsiyet penceresini açar."
-  IDS_HINT_SCAN         " Yeni ya da değiştirilmiş tak ve çalıştır aygıtları için tarar."
-  IDS_HINT_ENABLE       " Seçili aygıtı etkinleştirir."
-  IDS_HINT_DISABLE      " Seçili aygıtı edilginleştirir."
-  IDS_HINT_UPDATE       " Seçili aygıt için Sürücü Yazılımını Şimdikileştir yardımcısını başlatır."
-  IDS_HINT_UNINSTALL    " Seçili aygıt için sürücüyü kaldırır."
-  IDS_HINT_ADD          " Bilgisayara eski (Tak ve Çalıştır olmayan) bir aygıt ekler." 
-  IDS_HINT_ABOUT        " Aygıt Yöneticisi üzerine."
-  IDS_HINT_EXIT         " İzlenceden çıkar."
-
-  IDS_HINT_DEV_BY_TYPE  " Donanım türüne göre aygıtları görüntüler."
-  IDS_HINT_DEV_BY_CONN  " Bağlantıya göre aygıtları görüntüler."
-  IDS_HINT_RES_BY_TYPE  " Türe göre kaynakları görüntüler."
-  IDS_HINT_RES_BY_CONN  " Bağlantı türüne göre kaynakları görüntüler."
-  IDS_HINT_SHOW_HIDDEN  " Eski aygıtları ve artık kurulu olmayacak aygıtları görüntüler."
-
-  IDS_HINT_SYS_RESTORE  " Bu pencereyi düzgülük boyutlarına döndürür."
-  IDS_HINT_SYS_MOVE     " Bu pencereyi devindirir."
-  IDS_HINT_SYS_SIZE     " Bu pencereyi yeniden boyutlandırır."
-  IDS_HINT_SYS_MINIMIZE " Bu pencereyi bir simgeye küçültür."
-  IDS_HINT_SYS_MAXIMIZE " Bu pencereyi, bu görüntülüğü kaplatana dek genişletir."
-  IDS_HINT_SYS_CLOSE    " Bu pencereyi kapatır."
-END
diff --git a/dll/win32/devmgr/devmgmt/res/computer.ico b/dll/win32/devmgr/devmgmt/res/computer.ico
deleted file mode 100644 (file)
index 56edfcb..0000000
Binary files a/dll/win32/devmgr/devmgmt/res/computer.ico and /dev/null differ
diff --git a/dll/win32/devmgr/devmgmt/res/root.bmp b/dll/win32/devmgr/devmgmt/res/root.bmp
deleted file mode 100644 (file)
index e2734fb..0000000
Binary files a/dll/win32/devmgr/devmgmt/res/root.bmp and /dev/null differ
diff --git a/dll/win32/devmgr/devmgmt/res/toolbar.bmp b/dll/win32/devmgr/devmgmt/res/toolbar.bmp
deleted file mode 100644 (file)
index c7dd5ac..0000000
Binary files a/dll/win32/devmgr/devmgmt/res/toolbar.bmp and /dev/null differ
diff --git a/dll/win32/devmgr/devmgmt/rsrc.rc b/dll/win32/devmgr/devmgmt/rsrc.rc
deleted file mode 100644 (file)
index 2d50111..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#include <windows.h>
-#include "resource.h"
-
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-
-IDI_MAIN_ICON   ICON    "res/computer.ico"
-IDB_ROOT_IMAGE  BITMAP  "res/root.bmp"
-
-/* main toolbar icons */
-IDB_TOOLBAR    BITMAP DISCARDABLE "res/toolbar.bmp"
-
-// UTF-8
-#pragma code_page(65001)
-
-#ifdef LANGUAGE_BG_BG
-    #include "lang/bg-BG.rc"
-#endif
-#ifdef LANGUAGE_DE_DE
-    #include "lang/de-DE.rc"
-#endif
-#ifdef LANGUAGE_EL_GR
-    #include "lang/el-GR.rc"
-#endif
-#ifdef LANGUAGE_EN_US
-    #include "lang/en-US.rc"
-#endif
-#ifdef LANGUAGE_ES_ES
-    #include "lang/es-ES.rc"
-#endif
-#ifdef LANGUAGE_FR_FR
-    #include "lang/fr-FR.rc"
-#endif
-#ifdef LANGUAGE_HE_IL
-    #include "lang/he-IL.rc"
-#endif
-#ifdef LANGUAGE_ID_ID
-    #include "lang/id-ID.rc"
-#endif
-#ifdef LANGUAGE_IT_IT
-    #include "lang/it-IT.rc"
-#endif
-#ifdef LANGUAGE_JA_JP
-    #include "lang/ja-JP.rc"
-#endif
-#ifdef LANGUAGE_KO_KR
-    #include "lang/ko-KR.rc"
-#endif
-#ifdef LANGUAGE_NB_NO
-    #include "lang/no-NO.rc"
-#endif
-#ifdef LANGUAGE_PL_PL
-    #include "lang/pl-PL.rc"
-#endif
-#ifdef LANGUAGE_PT_BR
-    #include "lang/pt-BR.rc"
-#endif
-#ifdef LANGUAGE_RO_RO
-    #include "lang/ro-RO.rc"
-#endif
-#ifdef LANGUAGE_RU_RU
-    #include "lang/ru-RU.rc"
-#endif
-#ifdef LANGUAGE_SK_SK
-    #include "lang/sk-SK.rc"
-#endif
-#ifdef LANGUAGE_SV_SE
-    #include "lang/sv-SE.rc"
-#endif
-#ifdef LANGUAGE_TH_TH
-    #include "lang/th-TH.rc"
-#endif
-#ifdef LANGUAGE_TR_TR
-    #include "lang/tr-TR.rc"
-#endif
-#ifdef LANGUAGE_UK_UA
-    #include "lang/uk-UA.rc"
-#endif
-#ifdef LANGUAGE_ZH_CN
-    #include "lang/zh-CN.rc"
-#endif
diff --git a/dll/win32/devmgr/devmgmt/stdafx.h b/dll/win32/devmgr/devmgmt/stdafx.h
deleted file mode 100644 (file)
index 8802296..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#pragma once
-
-#ifndef __REACTOS__
-
-#define WIN32_LEAN_AND_MEAN
-#include <Windows.h>
-#include <windowsx.h>
-#include <setupapi.h>
-#include <cfgmgr32.h>
-#include <commctrl.h>
-#include <Uxtheme.h>
-#include <Cfgmgr32.h>
-#include <devguid.h>
-#include <process.h>
-
-
-#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // some CString constructors will be explicit
-#include <tchar.h>
-#include <atlbase.h>
-#include <atlstr.h>
-#include <atlcoll.h>
-
-#include <strsafe.h>
-#else
-
-#include <string.h>
-#include <wchar.h>
-
-#include <tchar.h>
-#include <windef.h>
-#include <winbase.h>
-#include <winreg.h>
-#include <wingdi.h>
-#include <winnls.h>
-#include <wincon.h>
-#include <shlobj.h>
-#include <shlwapi.h>
-#include <strsafe.h>
-#include <process.h>
-#include <WindowsX.h>
-#include <strsafe.h>
-
-#include <setupapi.h>
-#include <commctrl.h>
-#include <cfgmgr32.h>
-#include <Uxtheme.h>
-#include <devguid.h>
-
-#include <atlbase.h>
-#include <atlstr.h>
-#include <atlcoll.h>
-
-#endif
\ No newline at end of file
diff --git a/dll/win32/devmgr/devprblm.c b/dll/win32/devmgr/devprblm.c
deleted file mode 100644 (file)
index 9d684db..0000000
+++ /dev/null
@@ -1,614 +0,0 @@
-/*
- * ReactOS Device Manager Applet
- * Copyright (C) 2004 - 2005 ReactOS Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-/*
- * PROJECT:         ReactOS devmgr.dll
- * FILE:            lib/devmgr/devprblm.c
- * PURPOSE:         ReactOS Device Manager
- * PROGRAMMER:      Thomas Weidenmueller <w3seek@reactos.com>
- * UPDATE HISTORY:
- *      04-04-2004  Created
- */
-
-#include "precomp.h"
-
-
-BOOL
-ShowDeviceProblemWizard(IN HWND hWndParent  OPTIONAL,
-                        IN HDEVINFO hDevInfo,
-                        IN PSP_DEVINFO_DATA DevInfoData,
-                        IN HMACHINE hMachine  OPTIONAL)
-{
-    WCHAR szDeviceInstanceId[256];
-    CONFIGRET cr;
-    ULONG Status, ProblemNumber;
-    DWORD dwReboot;
-    BOOL Ret = FALSE;
-
-    /* Get the device instance id */
-    if (!SetupDiGetDeviceInstanceId(hDevInfo,
-                                    DevInfoData,
-                                    szDeviceInstanceId,
-                                    256,
-                                    NULL))
-        return FALSE;
-
-    cr = CM_Get_DevNode_Status_Ex(&Status,
-                                  &ProblemNumber,
-                                  DevInfoData->DevInst,
-                                  0,
-                                  hMachine);
-    if (cr == CR_SUCCESS && (Status & DN_HAS_PROBLEM))
-    {
-        switch (ProblemNumber)
-        {
-            case CM_PROB_DEVLOADER_FAILED:
-            {
-                /* FIXME - only if it's not a root bus devloader */
-                /* FIXME - display the update driver wizard */
-                break;
-            }
-
-            case CM_PROB_OUT_OF_MEMORY:
-            case CM_PROB_ENTRY_IS_WRONG_TYPE:
-            case CM_PROB_LACKED_ARBITRATOR:
-            case CM_PROB_FAILED_START:
-            case CM_PROB_LIAR:
-            case CM_PROB_UNKNOWN_RESOURCE:
-            {
-                /* FIXME - display the update driver wizard */
-                InstallDevInst(hWndParent, szDeviceInstanceId, TRUE, &dwReboot);
-                break;
-            }
-
-            case CM_PROB_BOOT_CONFIG_CONFLICT:
-            case CM_PROB_NORMAL_CONFLICT:
-            case CM_PROB_REENUMERATION:
-            {
-                /* FIXME - display the conflict wizard */
-                break;
-            }
-
-            case CM_PROB_FAILED_FILTER:
-            case CM_PROB_REINSTALL:
-            case CM_PROB_FAILED_INSTALL:
-            {
-                /* FIXME - display the driver (re)installation wizard */
-                InstallDevInst(hWndParent, szDeviceInstanceId, TRUE, &dwReboot);
-                break;
-            }
-
-            case CM_PROB_DEVLOADER_NOT_FOUND:
-            {
-                /* FIXME - 4 cases:
-                   1) if it's a missing system devloader:
-                      - fail
-                   2) if it's not a system devloader but still missing:
-                      - display the driver reinstallation wizard
-                   3) if it's not a system devloader but the file can be found:
-                      - display the update driver wizard
-                   4) if it's a missing or empty software key
-                      - display the update driver wizard
-                 */
-                break;
-            }
-
-            case CM_PROB_INVALID_DATA:
-            case CM_PROB_PARTIAL_LOG_CONF:
-            case CM_PROB_NO_VALID_LOG_CONF:
-            case CM_PROB_HARDWARE_DISABLED:
-            case CM_PROB_CANT_SHARE_IRQ:
-            case CM_PROB_TRANSLATION_FAILED:
-            case CM_PROB_SYSTEM_SHUTDOWN:
-            case CM_PROB_PHANTOM:
-                /* FIXME - do nothing */
-                break;
-
-            case CM_PROB_NOT_VERIFIED:
-            case CM_PROB_DEVICE_NOT_THERE:
-                /* FIXME - display search hardware wizard */
-                break;
-
-            case CM_PROB_NEED_RESTART:
-            case CM_PROB_WILL_BE_REMOVED:
-            case CM_PROB_MOVED:
-            case CM_PROB_TOO_EARLY:
-            case CM_PROB_DISABLED_SERVICE:
-                /* FIXME - reboot computer */
-                break;
-
-            case CM_PROB_REGISTRY:
-                /* FIXME - check registry */
-                break;
-
-            case CM_PROB_DISABLED:
-            {
-                /* FIXME - if device was disabled by user display the "Enable Device" wizard,
-                           otherwise Troubleshoot because the device was disabled by the system */
-                break;
-            }
-
-            case CM_PROB_DEVLOADER_NOT_READY:
-            {
-                /* FIXME - if it's a graphics adapter:
-                           - if it's a a secondary adapter and the main adapter
-                             couldn't be found
-                             - do nothing or default action
-                           - else
-                             - display the Properties
-                         - else
-                           - Update driver
-                 */
-                break;
-            }
-
-            case CM_PROB_FAILED_ADD:
-            {
-                /* FIXME - display the properties of the sub-device */
-                break;
-            }
-
-            case CM_PROB_NO_SOFTCONFIG:
-            case CM_PROB_IRQ_TRANSLATION_FAILED:
-            case CM_PROB_FAILED_DRIVER_ENTRY:
-            case CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD:
-            case CM_PROB_DRIVER_FAILED_LOAD:
-            case CM_PROB_DRIVER_SERVICE_KEY_INVALID:
-            case CM_PROB_LEGACY_SERVICE_NO_DEVICES:
-            case CM_PROB_DUPLICATE_DEVICE:
-            case CM_PROB_FAILED_POST_START:
-            case CM_PROB_HALTED:
-            case CM_PROB_HELD_FOR_EJECT:
-            case CM_PROB_DRIVER_BLOCKED:
-            case CM_PROB_REGISTRY_TOO_LARGE:
-            default:
-            {
-                /* FIXME - troubleshoot the device */
-                break;
-            }
-        }
-    }
-
-    return Ret;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceProblemWizardA
- *
- * DESCRIPTION
- *   Calls the device problem wizard
- *
- * ARGUMENTS
- *   hWndParent:    Handle to the parent window
- *   lpMachineName: Machine Name, NULL is the local machine
- *   lpDeviceID:    Specifies the device, also see NOTEs
- *
- * RETURN VALUE
- *   TRUE:  if no errors occured
- *   FALSE: if errors occured
- *
- * @implemented
- */
-BOOL
-WINAPI
-DeviceProblemWizardA(IN HWND hWndParent  OPTIONAL,
-                     IN LPCSTR lpMachineName  OPTIONAL,
-                     IN LPCSTR lpDeviceID)
-{
-    LPWSTR lpMachineNameW = NULL;
-    LPWSTR lpDeviceIDW = NULL;
-    BOOL Ret = FALSE;
-
-    if (lpMachineName != NULL)
-    {
-        if (!(lpMachineNameW = ConvertMultiByteToUnicode(lpMachineName,
-                                                         CP_ACP)))
-        {
-            goto Cleanup;
-        }
-    }
-    if (lpDeviceID != NULL)
-    {
-        if (!(lpDeviceIDW = ConvertMultiByteToUnicode(lpDeviceID,
-                                                      CP_ACP)))
-        {
-            goto Cleanup;
-        }
-    }
-
-    Ret = DeviceProblemWizardW(hWndParent,
-                               lpMachineNameW,
-                               lpDeviceIDW);
-
-Cleanup:
-    if (lpMachineNameW != NULL)
-    {
-        HeapFree(GetProcessHeap(),
-                 0,
-                 lpMachineNameW);
-    }
-    if (lpDeviceIDW != NULL)
-    {
-        HeapFree(GetProcessHeap(),
-                 0,
-                 lpDeviceIDW);
-    }
-
-    return Ret;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceProblemWizardW
- *
- * DESCRIPTION
- *   Calls the device problem wizard
- *
- * ARGUMENTS
- *   hWndParent:    Handle to the parent window
- *   lpMachineName: Machine Name, NULL is the local machine
- *   lpDeviceID:    Specifies the device, also see NOTEs
- *
- * RETURN VALUE
- *   TRUE:  if no errors occured
- *   FALSE: if errors occured
- *
- * @unimplemented
- */
-BOOL
-WINAPI
-DeviceProblemWizardW(IN HWND hWndParent  OPTIONAL,
-                     IN LPCWSTR lpMachineName  OPTIONAL,
-                     IN LPCWSTR lpDeviceID)
-{
-    HDEVINFO hDevInfo;
-    SP_DEVINFO_DATA DevInfoData;
-    HINSTANCE hComCtl32;
-    CONFIGRET cr;
-    HMACHINE hMachine;
-    BOOL Ret = FALSE;
-
-    if (lpDeviceID == NULL)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return FALSE;
-    }
-
-    /* dynamically load comctl32 */
-    hComCtl32 = LoadAndInitComctl32();
-    if (hComCtl32 != NULL)
-    {
-        hDevInfo = SetupDiCreateDeviceInfoListEx(NULL,
-                                                 hWndParent,
-                                                 lpMachineName,
-                                                 NULL);
-        if (hDevInfo != INVALID_HANDLE_VALUE)
-        {
-            cr = CM_Connect_Machine(lpMachineName,
-                                    &hMachine);
-            if (cr == CR_SUCCESS)
-            {
-                DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
-                if (SetupDiOpenDeviceInfo(hDevInfo,
-                                          lpDeviceID,
-                                          hWndParent,
-                                          0,
-                                          &DevInfoData))
-                {
-                    Ret = ShowDeviceProblemWizard(hWndParent,
-                                                  hDevInfo,
-                                                  &DevInfoData,
-                                                  hMachine);
-                }
-
-                CM_Disconnect_Machine(hMachine);
-            }
-
-            SetupDiDestroyDeviceInfoList(hDevInfo);
-        }
-
-        FreeLibrary(hComCtl32);
-    }
-
-    return Ret;
-}
-
-
-static const UINT ProblemStringId[NUM_CM_PROB] =
-{
-    IDS_DEV_NO_PROBLEM,
-    IDS_DEV_DEVLOADER_FAILED,
-    IDS_DEV_NOT_CONFIGURED,
-    IDS_DEV_OUT_OF_MEMORY,
-    IDS_DEV_ENTRY_IS_WRONG_TYPE,
-    IDS_DEV_LACKED_ARBITRATOR,
-    IDS_DEV_BOOT_CONFIG_CONFLICT,
-    IDS_DEV_FAILED_FILTER,
-    IDS_DEV_DEVLOADER_NOT_FOUND,
-    IDS_DEV_INVALID_DATA,
-    IDS_DEV_FAILED_START,
-    IDS_DEV_LIAR,
-    IDS_DEV_NORMAL_CONFLICT,
-    IDS_DEV_NOT_VERIFIED,
-    IDS_DEV_NEED_RESTART,
-    IDS_DEV_REENUMERATION,
-    IDS_DEV_PARTIAL_LOG_CONF,
-    IDS_DEV_UNKNOWN_RESOURCE,
-    IDS_DEV_REINSTALL,
-    IDS_DEV_REGISTRY,
-    IDS_UNKNOWN, /* CM_PROB_VXDLDR, not used on NT */
-    IDS_DEV_WILL_BE_REMOVED,
-    IDS_DEV_DISABLED,
-    IDS_DEV_DEVLOADER_NOT_READY,
-    IDS_DEV_DEVICE_NOT_THERE,
-    IDS_DEV_MOVED,
-    IDS_DEV_TOO_EARLY,
-    IDS_DEV_NO_VALID_LOG_CONF,
-    IDS_DEV_FAILED_INSTALL,
-    IDS_DEV_HARDWARE_DISABLED,
-    IDS_DEV_CANT_SHARE_IRQ,
-    IDS_DEV_FAILED_ADD,
-    IDS_DEV_DISABLED_SERVICE,
-    IDS_DEV_TRANSLATION_FAILED,
-    IDS_DEV_NO_SOFTCONFIG,
-    IDS_DEV_BIOS_TABLE,
-    IDS_DEV_IRQ_TRANSLATION_FAILED,
-    IDS_DEV_FAILED_DRIVER_ENTRY,
-    IDS_DEV_DRIVER_FAILED_PRIOR_UNLOAD,
-    IDS_DEV_DRIVER_FAILED_LOAD,
-    IDS_DEV_DRIVER_SERVICE_KEY_INVALID,
-    IDS_DEV_LEGACY_SERVICE_NO_DEVICES,
-    IDS_DEV_DUPLICATE_DEVICE,
-    IDS_DEV_FAILED_POST_START,
-    IDS_DEV_HALTED,
-    IDS_DEV_PHANTOM,
-    IDS_DEV_SYSTEM_SHUTDOWN,
-    IDS_DEV_HELD_FOR_EJECT,
-    IDS_DEV_DRIVER_BLOCKED,
-    IDS_DEV_REGISTRY_TOO_LARGE,
-    IDS_DEV_SETPROPERTIES_FAILED
-};
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceProblemTextA
- *
- * DESCRIPTION
- *   Gets the problem text from a problem number displayed in the properties dialog
- *
- * ARGUMENTS
- *   hMachine:   Machine handle or NULL for the local machine
- *   DevInst:    Device instance handle
- *   uProblemId: Specifies the problem ID
- *   lpString:   Pointer to a buffer where the string is to be copied to. If the buffer
- *               is too small, the return value is the required string length in characters,
- *               excluding the NULL-termination.
- *   uMaxString: Size of the buffer in characters
- *
- * RETURN VALUE
- *   The return value is the length of the string in characters.
- *   It returns 0 if an error occured.
- *
- * @implemented
- */
-UINT
-WINAPI
-DeviceProblemTextA(IN HMACHINE hMachine  OPTIONAL,
-                   IN DEVINST dnDevInst,
-                   IN ULONG uProblemId,
-                   OUT LPSTR lpString,
-                   IN UINT uMaxString)
-{
-    LPWSTR lpBuffer = NULL;
-    UINT Ret = 0;
-
-    if (uMaxString != 0)
-    {
-        lpBuffer = HeapAlloc(GetProcessHeap(),
-                             0,
-                             (uMaxString + 1) * sizeof(WCHAR));
-        if (lpBuffer == NULL)
-        {
-            SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-            return 0;
-        }
-    }
-
-    Ret = DeviceProblemTextW(hMachine,
-                             dnDevInst,
-                             uProblemId,
-                             lpBuffer,
-                             uMaxString);
-
-    if (lpBuffer != NULL)
-    {
-        if (Ret)
-        {
-            WideCharToMultiByte(CP_ACP,
-                                0,
-                                lpBuffer,
-                                (int)Ret,
-                                lpString,
-                                (int)uMaxString,
-                                NULL,
-                                NULL);
-        }
-
-        HeapFree(GetProcessHeap(),
-                 0,
-                 lpBuffer);
-    }
-
-    return Ret;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceProblemTextW
- *
- * DESCRIPTION
- *   Gets the problem text from a problem number displayed in the properties dialog
- *
- * ARGUMENTS
- *   hMachine:   Machine handle or NULL for the local machine
- *   DevInst:    Device instance handle
- *   uProblemId: Specifies the problem ID
- *   lpString:   Pointer to a buffer where the string is to be copied to. If the buffer
- *               is too small, the return value is the required string length in characters,
- *               excluding the NULL-termination.
- *   uMaxString: Size of the buffer in characters
- *
- * RETURN VALUE
- *   The return value is the length of the string in characters.
- *   It returns 0 if an error occured.
- *
- * @implemented
- */
-UINT
-WINAPI
-DeviceProblemTextW(IN HMACHINE hMachine  OPTIONAL,
-                   IN DEVINST dnDevInst,
-                   IN ULONG uProblemId,
-                   OUT LPWSTR lpString,
-                   IN UINT uMaxString)
-{
-    UINT MessageId = IDS_UNKNOWN;
-    UINT Ret = 0;
-
-    if (uProblemId < sizeof(ProblemStringId) / sizeof(ProblemStringId[0]))
-        MessageId = ProblemStringId[uProblemId];
-
-    if (uProblemId == 0)
-    {
-        if (uMaxString != 0)
-        {
-            Ret = LoadString(hDllInstance,
-                             MessageId,
-                             lpString,
-                             (int)uMaxString);
-        }
-        else
-        {
-            Ret = (UINT)LengthOfStrResource(hDllInstance,
-                                            MessageId);
-        }
-    }
-    else
-    {
-        LPWSTR szProblem, szInfo = L"FIXME";
-        DWORD dwRet;
-        BOOL AdvFormat = FALSE;
-        UINT StringIDs[] =
-        {
-            MessageId,
-            IDS_DEVCODE,
-        };
-
-        switch (uProblemId)
-        {
-            case CM_PROB_DEVLOADER_FAILED:
-            {
-                /* FIXME - if not a root bus devloader then use IDS_DEV_DEVLOADER_FAILED2 */
-                /* FIXME - get the type string (ie. ISAPNP, PCI or BIOS for root bus devloaders,
-                           or FLOP, ESDI, SCSI, etc for others */
-                AdvFormat = TRUE;
-                break;
-            }
-
-            case CM_PROB_DEVLOADER_NOT_FOUND:
-            {
-                /* FIXME - 4 cases:
-                   1) if it's a missing system devloader:
-                      - get the system devloader name
-                   2) if it's not a system devloader but still missing:
-                      - get the devloader name (file name?)
-                   3) if it's not a system devloader but the file can be found:
-                      - use IDS_DEV_DEVLOADER_NOT_FOUND2
-                   4) if it's a missing or empty software key
-                      - use IDS_DEV_DEVLOADER_NOT_FOUND3
-                      - AdvFormat = FALSE!
-                 */
-                AdvFormat = TRUE;
-                break;
-            }
-
-            case CM_PROB_INVALID_DATA:
-                /* FIXME - if the device isn't enumerated by the BIOS/ACPI use IDS_DEV_INVALID_DATA2 */
-                AdvFormat = FALSE;
-                break;
-
-            case CM_PROB_NORMAL_CONFLICT:
-                /* FIXME - get resource type (IRQ, DMA, Memory or I/O) */
-                AdvFormat = TRUE;
-                break;
-
-            case CM_PROB_UNKNOWN_RESOURCE:
-                /* FIXME - get the .inf file name */
-                AdvFormat = TRUE;
-                break;
-
-            case CM_PROB_DISABLED:
-                /* FIXME - if the device was disabled by the system use IDS_DEV_DISABLED2 */
-                break;
-
-            case CM_PROB_FAILED_ADD:
-                /* FIXME - get the name of the sub-device with the error */
-                AdvFormat = TRUE;
-                break;
-        }
-
-        if (AdvFormat)
-        {
-            StringIDs[1] = IDS_DEVCODE2;
-            dwRet = LoadAndFormatStringsCat(hDllInstance,
-                                            StringIDs,
-                                            sizeof(StringIDs) / sizeof(StringIDs[0]),
-                                            &szProblem,
-                                            szInfo,
-                                            uProblemId);
-        }
-        else
-        {
-            dwRet = LoadAndFormatStringsCat(hDllInstance,
-                                            StringIDs,
-                                            sizeof(StringIDs) / sizeof(StringIDs[0]),
-                                            &szProblem,
-                                            uProblemId);
-        }
-
-        if (dwRet != 0)
-        {
-            if (uMaxString != 0 && uMaxString >= dwRet)
-            {
-                wcscpy(lpString,
-                       szProblem);
-            }
-
-            LocalFree((HLOCAL)szProblem);
-
-            Ret = dwRet;
-        }
-    }
-
-    return Ret;
-}
diff --git a/dll/win32/devmgr/hwpage.c b/dll/win32/devmgr/hwpage.c
deleted file mode 100644 (file)
index 2d7eae6..0000000
+++ /dev/null
@@ -1,1116 +0,0 @@
-/*
- * ReactOS Device Manager Applet
- * Copyright (C) 2004 - 2005 ReactOS Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-/*
- * PROJECT:         ReactOS devmgr.dll
- * FILE:            lib/devmgr/hwpage.c
- * PURPOSE:         ReactOS Device Manager
- * PROGRAMMER:      Thomas Weidenmueller <w3seek@reactos.com>
- * UPDATE HISTORY:
- *      04-04-2004  Created
- */
-
-#include "precomp.h"
-
-
-typedef struct _HWDEVINFO
-{
-    struct _HWCLASSDEVINFO *ClassDevInfo;
-    SP_DEVINFO_DATA DevInfoData;
-    BOOL HideDevice;
-} HWDEVINFO, *PHWDEVINFO;
-
-typedef struct _HWCLASSDEVINFO
-{
-    GUID Guid;
-    HDEVINFO hDevInfo;
-    INT ImageIndex;
-    INT ItemCount;
-    PHWDEVINFO HwDevInfo;
-} HWCLASSDEVINFO, *PHWCLASSDEVINFO;
-
-typedef struct _HARDWARE_PAGE_DATA
-{
-    HWND hWnd;
-    HWND hWndDevList;
-    HINSTANCE hComCtl32; /* only save this to keep track of the references */
-    INT DevListViewHeight;
-    SP_CLASSIMAGELIST_DATA ClassImageListData;
-    HWPAGE_DISPLAYMODE DisplayMode;
-
-    /* parent window subclass info */
-    WNDPROC ParentOldWndProc;
-    HWND hWndParent;
-
-    UINT NumberOfGuids;
-    HWCLASSDEVINFO ClassDevInfo[1];
-    /* struct may be dynamically expanded here! */
-} HARDWARE_PAGE_DATA, *PHARDWARE_PAGE_DATA;
-
-#define CX_TYPECOLUMN_WIDTH 80
-
-static VOID
-InitializeDevicesList(IN PHARDWARE_PAGE_DATA hpd)
-{
-    LVCOLUMN lvc;
-    RECT rcClient;
-    WCHAR szColName[255];
-    int iCol = 0;
-
-    /* set the list view style */
-    (void)ListView_SetExtendedListViewStyle(hpd->hWndDevList,
-                                            LVS_EX_FULLROWSELECT);
-
-    /* set the list view image list */
-    if (hpd->ClassImageListData.ImageList != NULL)
-    {
-        (void)ListView_SetImageList(hpd->hWndDevList,
-                                    hpd->ClassImageListData.ImageList,
-                                    LVSIL_SMALL);
-    }
-
-    GetClientRect(hpd->hWndDevList,
-                  &rcClient);
-
-    /* add the list view columns */
-    lvc.mask = LVCF_TEXT | LVCF_WIDTH;
-    lvc.fmt = LVCFMT_LEFT;
-    lvc.pszText = szColName;
-
-    if (LoadString(hDllInstance,
-                   IDS_NAME,
-                   szColName,
-                   sizeof(szColName) / sizeof(szColName[0])))
-    {
-        lvc.cx = rcClient.right - CX_TYPECOLUMN_WIDTH -
-                 GetSystemMetrics(SM_CXVSCROLL);
-        (void)ListView_InsertColumn(hpd->hWndDevList,
-                                    iCol++,
-                                    &lvc);
-    }
-    if (LoadString(hDllInstance,
-                   IDS_TYPE,
-                   szColName,
-                   sizeof(szColName) / sizeof(szColName[0])))
-    {
-        lvc.cx = CX_TYPECOLUMN_WIDTH;
-        (void)ListView_InsertColumn(hpd->hWndDevList,
-                                    iCol++,
-                                    &lvc);
-    }
-}
-
-
-static BOOL
-DisplaySelectedDeviceProperties(IN PHARDWARE_PAGE_DATA hpd)
-{
-    PHWDEVINFO HwDevInfo;
-    SP_DEVINFO_DATA DevInfoData;
-    BOOL Ret = FALSE;
-
-    HwDevInfo = (PHWDEVINFO)ListViewGetSelectedItemData(hpd->hWndDevList);
-    if (HwDevInfo != NULL)
-    {
-        /* make a copy of the SP_DEVINFO_DATA structure on the stack, it may
-           become invalid in case the devices are updated */
-        DevInfoData = HwDevInfo->DevInfoData;
-
-        /* display the advanced properties */
-        Ret = DisplayDeviceAdvancedProperties(hpd->hWnd,
-                                              NULL,
-                                              HwDevInfo->ClassDevInfo->hDevInfo,
-                                              &DevInfoData,
-                                              hpd->hComCtl32,
-                                              NULL,
-                                              0) != -1;
-    }
-
-    return Ret;
-}
-
-
-static VOID
-UpdateControlStates(IN PHARDWARE_PAGE_DATA hpd)
-{
-    PHWDEVINFO HwDevInfo;
-    HWND hBtnTroubleShoot, hBtnProperties;
-
-    hBtnTroubleShoot = GetDlgItem(hpd->hWnd,
-                                  IDC_TROUBLESHOOT);
-    hBtnProperties = GetDlgItem(hpd->hWnd,
-                                IDC_PROPERTIES);
-
-    HwDevInfo = (PHWDEVINFO)ListViewGetSelectedItemData(hpd->hWndDevList);
-    if (HwDevInfo != NULL)
-    {
-        /* update static controls */
-        WCHAR szBuffer[256];
-        LPWSTR szFormatted = NULL;
-
-        /* get the manufacturer string */
-        if (GetDeviceManufacturerString(HwDevInfo->ClassDevInfo->hDevInfo,
-                                        &HwDevInfo->DevInfoData,
-                                        szBuffer,
-                                        sizeof(szBuffer) / sizeof(szBuffer[0])) &&
-            LoadAndFormatString(hDllInstance,
-                                IDS_MANUFACTURER,
-                                &szFormatted,
-                                szBuffer) != 0)
-        {
-            SetDlgItemText(hpd->hWnd,
-                           IDC_MANUFACTURER,
-                           szFormatted);
-            LocalFree((HLOCAL)szFormatted);
-        }
-
-        /* get the location string */
-        if (GetDeviceLocationString(HwDevInfo->ClassDevInfo->hDevInfo,
-                                    &HwDevInfo->DevInfoData,
-                                    0,
-                                    szBuffer,
-                                    sizeof(szBuffer) / sizeof(szBuffer[0])) &&
-            LoadAndFormatString(hDllInstance,
-                                IDS_LOCATION,
-                                &szFormatted,
-                                szBuffer) != 0)
-        {
-            SetDlgItemText(hpd->hWnd,
-                           IDC_LOCATION,
-                           szFormatted);
-            LocalFree((HLOCAL)szFormatted);
-        }
-
-        if (GetDeviceStatusString(HwDevInfo->DevInfoData.DevInst,
-                                  NULL,
-                                  szBuffer,
-                                  sizeof(szBuffer) / sizeof(szBuffer[0])) &&
-            LoadAndFormatString(hDllInstance,
-                                IDS_STATUS,
-                                &szFormatted,
-                                szBuffer) != 0)
-        {
-            SetDlgItemText(hpd->hWnd,
-                           IDC_STATUS,
-                           szFormatted);
-            LocalFree((HLOCAL)szFormatted);
-        }
-    }
-    else
-    {
-        /* clear static controls */
-        SetDlgItemText(hpd->hWnd,
-                       IDC_MANUFACTURER,
-                       NULL);
-        SetDlgItemText(hpd->hWnd,
-                       IDC_LOCATION,
-                       NULL);
-        SetDlgItemText(hpd->hWnd,
-                       IDC_STATUS,
-                       NULL);
-    }
-
-    EnableWindow(hBtnTroubleShoot,
-                 HwDevInfo != NULL);
-    EnableWindow(hBtnProperties,
-                 HwDevInfo != NULL);
-}
-
-
-static VOID
-FreeDevicesList(IN PHARDWARE_PAGE_DATA hpd)
-{
-    PHWCLASSDEVINFO ClassDevInfo, LastClassDevInfo;
-
-    ClassDevInfo = hpd->ClassDevInfo;
-    LastClassDevInfo = ClassDevInfo + hpd->NumberOfGuids;
-
-    /* free the device info set handles and structures */
-    while (ClassDevInfo != LastClassDevInfo)
-    {
-        if (ClassDevInfo->hDevInfo != INVALID_HANDLE_VALUE)
-        {
-            SetupDiDestroyDeviceInfoList(ClassDevInfo->hDevInfo);
-            ClassDevInfo->hDevInfo = INVALID_HANDLE_VALUE;
-        }
-
-        ClassDevInfo->ItemCount = 0;
-        ClassDevInfo->ImageIndex = 0;
-
-        if (ClassDevInfo->HwDevInfo != NULL)
-        {
-            HeapFree(GetProcessHeap(),
-                     0,
-                     ClassDevInfo->HwDevInfo);
-            ClassDevInfo->HwDevInfo = NULL;
-        }
-
-        ClassDevInfo++;
-    }
-}
-
-
-static VOID
-BuildDevicesList(IN PHARDWARE_PAGE_DATA hpd)
-{
-    PHWCLASSDEVINFO ClassDevInfo, LastClassDevInfo;
-    SP_DEVINFO_DATA DevInfoData;
-
-    DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
-
-    ClassDevInfo = hpd->ClassDevInfo;
-    LastClassDevInfo = ClassDevInfo + hpd->NumberOfGuids;
-
-    while (ClassDevInfo != LastClassDevInfo)
-    {
-        ClassDevInfo->ImageIndex = -1;
-
-        /* open a class device handle for the GUID we're processing */
-        ClassDevInfo->hDevInfo = SetupDiGetClassDevs(&ClassDevInfo->Guid,
-                                                     NULL,
-                                                     hpd->hWnd,
-                                                     DIGCF_PRESENT | DIGCF_PROFILE);
-        if (ClassDevInfo->hDevInfo != INVALID_HANDLE_VALUE)
-        {
-            DWORD MemberIndex = 0;
-
-            SetupDiGetClassImageIndex(&hpd->ClassImageListData,
-                                      &ClassDevInfo->Guid,
-                                      &ClassDevInfo->ImageIndex);
-
-            /* enumerate all devices in the class */
-            while (SetupDiEnumDeviceInfo(ClassDevInfo->hDevInfo,
-                                         MemberIndex++,
-                                         &DevInfoData))
-            {
-                BOOL HideDevice = FALSE;
-
-                if (ClassDevInfo->HwDevInfo != NULL)
-                {
-                    PHWDEVINFO HwNewDevInfo = HeapReAlloc(GetProcessHeap(),
-                                                          0,
-                                                          ClassDevInfo->HwDevInfo,
-                                                          (ClassDevInfo->ItemCount + 1) *
-                                                              sizeof(HWDEVINFO));
-                    if (HwNewDevInfo != NULL)
-                    {
-                        ClassDevInfo->HwDevInfo = HwNewDevInfo;
-                    }
-                    else
-                    {
-                        ERR("Unable to allocate memory for %d SP_DEVINFO_DATA structures!\n",
-                            ClassDevInfo->ItemCount + 1);
-                        break;
-                    }
-                }
-                else
-                {
-                    ClassDevInfo->HwDevInfo = HeapAlloc(GetProcessHeap(),
-                                                        0,
-                                                        sizeof(HWDEVINFO));
-                    if (ClassDevInfo->HwDevInfo == NULL)
-                    {
-                        ERR("Unable to allocate memory for a SP_DEVINFO_DATA structures!\n");
-                        break;
-                    }
-                }
-
-                /* Find out if the device should be hidden by default */
-                IsDeviceHidden(DevInfoData.DevInst,
-                               NULL,
-                               &HideDevice);
-
-                /* save all information for the current device */
-                ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount].ClassDevInfo = ClassDevInfo;
-                ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount].DevInfoData = DevInfoData;
-                ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount++].HideDevice = HideDevice;
-            }
-        }
-
-        ClassDevInfo++;
-    }
-}
-
-
-static BOOL
-DeviceIdMatch(IN HDEVINFO DeviceInfoSet,
-              IN PSP_DEVINFO_DATA DeviceInfoData,
-              IN LPCWSTR lpDeviceId)
-{
-    DWORD DevIdLen;
-    LPWSTR lpQueriedDeviceId;
-    BOOL Ret = FALSE;
-
-    if (!SetupDiGetDeviceInstanceId(DeviceInfoSet,
-                                    DeviceInfoData,
-                                    NULL,
-                                    0,
-                                    &DevIdLen) &&
-        GetLastError() == ERROR_INSUFFICIENT_BUFFER)
-    {
-        if (DevIdLen == wcslen(lpDeviceId) + 1)
-        {
-            lpQueriedDeviceId = HeapAlloc(GetProcessHeap(),
-                                          0,
-                                          DevIdLen * sizeof(WCHAR));
-            if (lpQueriedDeviceId != NULL)
-            {
-                if (SetupDiGetDeviceInstanceId(DeviceInfoSet,
-                                               DeviceInfoData,
-                                               lpQueriedDeviceId,
-                                               DevIdLen,
-                                               NULL))
-                {
-                    Ret = (wcscmp(lpDeviceId,
-                                  lpQueriedDeviceId) == 0);
-                }
-
-                HeapFree(GetProcessHeap(),
-                         0,
-                         lpQueriedDeviceId);
-            }
-        }
-    }
-
-    return Ret;
-}
-
-
-static VOID
-FillDevicesListViewControl(IN PHARDWARE_PAGE_DATA hpd,
-                           IN LPCWSTR lpSelectDeviceId  OPTIONAL,
-                           IN GUID *SelectedClassGuid  OPTIONAL)
-{
-    PHWCLASSDEVINFO ClassDevInfo, LastClassDevInfo;
-    PHWDEVINFO HwDevInfo, LastHwDevInfo;
-    WCHAR szBuffer[255];
-    BOOL SelectedInClass;
-    INT ItemCount = 0;
-
-    BuildDevicesList(hpd);
-
-    ClassDevInfo = hpd->ClassDevInfo;
-    LastClassDevInfo = ClassDevInfo + hpd->NumberOfGuids;
-
-    while (ClassDevInfo != LastClassDevInfo)
-    {
-        if (ClassDevInfo->HwDevInfo != NULL)
-        {
-            HwDevInfo = ClassDevInfo->HwDevInfo;
-            LastHwDevInfo = HwDevInfo + ClassDevInfo->ItemCount;
-
-            SelectedInClass = (SelectedClassGuid != NULL &&
-                               IsEqualGUID(SelectedClassGuid,
-                                           &ClassDevInfo->Guid));
-            while (HwDevInfo != LastHwDevInfo)
-            {
-                INT iItem;
-                LVITEM li = {0};
-
-                /* get the device name */
-                if (!HwDevInfo->HideDevice &&
-                    GetDeviceDescriptionString(ClassDevInfo->hDevInfo,
-                                               &HwDevInfo->DevInfoData,
-                                               szBuffer,
-                                               sizeof(szBuffer) / sizeof(szBuffer[0])))
-                {
-                    li.mask = LVIF_PARAM | LVIF_STATE | LVIF_TEXT | LVIF_IMAGE;
-                    li.iItem = ItemCount;
-                    if ((ItemCount == 0 && lpSelectDeviceId == NULL) ||
-                        (SelectedInClass &&
-                         DeviceIdMatch(ClassDevInfo->hDevInfo,
-                                       &HwDevInfo->DevInfoData,
-                                       lpSelectDeviceId)))
-                    {
-                        li.state = LVIS_SELECTED;
-                    }
-                    li.stateMask = LVIS_SELECTED;
-                    li.pszText = szBuffer;
-                    li.iImage = ClassDevInfo->ImageIndex;
-                    li.lParam = (LPARAM)HwDevInfo;
-
-                    iItem = ListView_InsertItem(hpd->hWndDevList,
-                                                &li);
-                    if (iItem != -1)
-                    {
-                        ItemCount++;
-
-                        /* get the device type for the second column */
-                        if (GetDeviceTypeString(&HwDevInfo->DevInfoData,
-                                                szBuffer,
-                                                sizeof(szBuffer) / sizeof(szBuffer[0])))
-                        {
-                            li.mask = LVIF_TEXT;
-                            li.iItem = iItem;
-                            li.iSubItem = 1;
-
-                            (void)ListView_SetItem(hpd->hWndDevList,
-                                                   &li);
-                        }
-                    }
-                }
-
-                HwDevInfo++;
-            }
-        }
-
-        ClassDevInfo++;
-    }
-
-    /* update the controls */
-    UpdateControlStates(hpd);
-}
-
-
-static VOID
-UpdateDevicesListViewControl(IN PHARDWARE_PAGE_DATA hpd)
-{
-    PHWDEVINFO HwDevInfo;
-    GUID SelectedClassGuid = {0};
-    LPWSTR lpDeviceId = NULL;
-
-    /* if a device currently is selected, remember the device id so we can
-       select the device after the update if still present */
-    HwDevInfo = (PHWDEVINFO)ListViewGetSelectedItemData(hpd->hWndDevList);
-    if (HwDevInfo != NULL)
-    {
-        DWORD DevIdLen;
-        if (!SetupDiGetDeviceInstanceId(HwDevInfo->ClassDevInfo->hDevInfo,
-                                        &HwDevInfo->DevInfoData,
-                                        NULL,
-                                        0,
-                                        &DevIdLen) &&
-            GetLastError() == ERROR_INSUFFICIENT_BUFFER)
-        {
-            SelectedClassGuid = HwDevInfo->DevInfoData.ClassGuid;
-            lpDeviceId = HeapAlloc(GetProcessHeap(),
-                                   0,
-                                   DevIdLen * sizeof(WCHAR));
-            if (lpDeviceId != NULL &&
-                !SetupDiGetDeviceInstanceId(HwDevInfo->ClassDevInfo->hDevInfo,
-                                            &HwDevInfo->DevInfoData,
-                                            lpDeviceId,
-                                            DevIdLen,
-                                            NULL))
-            {
-                HeapFree(GetProcessHeap(),
-                         0,
-                         lpDeviceId);
-                lpDeviceId = NULL;
-            }
-        }
-    }
-
-    /* clear the devices list view control */
-    (void)ListView_DeleteAllItems(hpd->hWndDevList);
-
-    /* free the device list */
-    FreeDevicesList(hpd);
-
-    /* build rebuild the device list and fill the list box again */
-    FillDevicesListViewControl(hpd,
-                               lpDeviceId,
-                               (lpDeviceId != NULL ?
-                                    &SelectedClassGuid :
-                                    NULL));
-
-    if (lpDeviceId != NULL)
-    {
-        HeapFree(GetProcessHeap(),
-                 0,
-                 lpDeviceId);
-    }
-}
-
-
-static LRESULT
-CALLBACK
-ParentSubWndProc(IN HWND hwnd,
-                 IN UINT uMsg,
-                 IN WPARAM wParam,
-                 IN LPARAM lParam)
-{
-    PHARDWARE_PAGE_DATA hpd;
-
-    hpd = (PHARDWARE_PAGE_DATA)GetProp(hwnd,
-                                       L"DevMgrSubClassInfo");
-    if (hpd != NULL)
-    {
-        if (uMsg == WM_SIZE)
-        {
-            /* resize the hardware page */
-            SetWindowPos(hpd->hWnd,
-                         NULL,
-                         0,
-                         0,
-                         LOWORD(lParam),
-                         HIWORD(lParam),
-                         SWP_NOZORDER);
-        }
-        else if (uMsg == WM_DEVICECHANGE && IsWindowVisible(hpd->hWnd))
-        {
-            /* forward a WM_DEVICECHANGE message to the hardware
-               page which wouldn't get the message itself as it is
-               a child window */
-            SendMessage(hpd->hWnd,
-                        WM_DEVICECHANGE,
-                        wParam,
-                        lParam);
-        }
-
-        /* pass the message the the old window proc */
-        return CallWindowProc(hpd->ParentOldWndProc,
-                              hwnd,
-                              uMsg,
-                              wParam,
-                              lParam);
-    }
-    else
-    {
-        /* this is not a good idea if the subclassed window was an ansi
-           window, but we failed finding out the previous window proc
-           so we can't use CallWindowProc. This should rarely - if ever -
-           happen. */
-
-        return DefWindowProc(hwnd,
-                             uMsg,
-                             wParam,
-                             lParam);
-    }
-}
-
-
-static VOID
-HardwareDlgResize(IN PHARDWARE_PAGE_DATA hpd,
-                  IN INT cx,
-                  IN INT cy)
-{
-    HDWP dwp;
-    HWND hControl, hButton;
-    INT Width, x, y;
-    RECT rc, rcButton;
-    POINT pt = {0};
-    POINT ptMargin = {0};
-    POINT ptMarginGroup = {0};
-
-    /* use left margin of the IDC_DEVICES label as the right
-       margin of all controls outside the group box */
-    hControl = GetDlgItem(hpd->hWnd,
-                          IDC_DEVICES);
-    GetWindowRect(hControl,
-                  &rc);
-    MapWindowPoints(hControl,
-                    hpd->hWnd,
-                    &ptMargin,
-                    1);
-
-    Width = cx - (2 * ptMargin.x);
-
-    if ((dwp = BeginDeferWindowPos(8)))
-    {
-        /* rc already has the window rect of IDC_DEVICES! */
-        if (!(dwp = DeferWindowPos(dwp,
-                                   hControl,
-                                   NULL,
-                                   0,
-                                   0,
-                                   Width,
-                                   rc.bottom - rc.top,
-                                   SWP_NOMOVE | SWP_NOZORDER)))
-        {
-            return;
-        }
-
-        /* resize the devices list view control */
-        GetWindowRect(hpd->hWndDevList,
-                      &rc);
-        MapWindowPoints(hpd->hWndDevList,
-                        hpd->hWnd,
-                        &pt,
-                        1);
-        y = pt.y + hpd->DevListViewHeight + ptMargin.y;
-        if (!(dwp = DeferWindowPos(dwp,
-                                   hpd->hWndDevList,
-                                   NULL,
-                                   0,
-                                   0,
-                                   Width,
-                                   hpd->DevListViewHeight,
-                                   SWP_NOMOVE | SWP_NOZORDER)))
-        {
-            return;
-        }
-
-        /* resize the group box control */
-        hControl = GetDlgItem(hpd->hWnd,
-                              IDC_PROPERTIESGROUP);
-        GetWindowRect(hControl,
-                      &rc);
-        if (!(dwp = DeferWindowPos(dwp,
-                                   hControl,
-                                   NULL,
-                                   ptMargin.x,
-                                   y,
-                                   Width,
-                                   cy - y - ptMargin.y,
-                                   SWP_NOZORDER)))
-        {
-            return;
-        }
-
-        /* use left margin of the IDC_MANUFACTURER label as the right
-           margin of all controls inside the group box */
-        hControl = GetDlgItem(hpd->hWnd,
-                              IDC_MANUFACTURER);
-        GetWindowRect(hControl,
-                      &rc);
-        MapWindowPoints(hControl,
-                        hpd->hWnd,
-                        &ptMarginGroup,
-                        1);
-
-        ptMarginGroup.y = ptMargin.y * 2;
-        Width = cx - (2 * ptMarginGroup.x);
-        y += ptMarginGroup.y;
-        if (!(dwp = DeferWindowPos(dwp,
-                                   hControl,
-                                   NULL,
-                                   ptMarginGroup.x,
-                                   y,
-                                   Width,
-                                   rc.bottom - rc.top,
-                                   SWP_NOZORDER)))
-        {
-            return;
-        }
-        y += rc.bottom - rc.top + (ptMargin.y / 2);
-
-        /* resize the IDC_LOCATION label */
-        hControl = GetDlgItem(hpd->hWnd,
-                              IDC_LOCATION);
-        GetWindowRect(hControl,
-                      &rc);
-        if (!(dwp = DeferWindowPos(dwp,
-                                   hControl,
-                                   NULL,
-                                   ptMarginGroup.x,
-                                   y,
-                                   Width,
-                                   rc.bottom - rc.top,
-                                   SWP_NOZORDER)))
-        {
-            return;
-        }
-        y += rc.bottom - rc.top + (ptMargin.y / 2);
-
-        /* measure the size of the buttons */
-        hButton = GetDlgItem(hpd->hWnd,
-                             IDC_PROPERTIES);
-        GetWindowRect(hButton,
-                      &rcButton);
-
-        /* resize the IDC_STATUS label */
-        hControl = GetDlgItem(hpd->hWnd,
-                              IDC_STATUS);
-        GetWindowRect(hControl,
-                      &rc);
-        if (!(dwp = DeferWindowPos(dwp,
-                                   hControl,
-                                   NULL,
-                                   ptMarginGroup.x,
-                                   y,
-                                   Width,
-                                   cy - y - (3 * ptMargin.y) -
-                                       (rcButton.bottom - rcButton.top),
-                                   SWP_NOZORDER)))
-        {
-            return;
-        }
-
-        /* move the IDC_PROPERTIES button */
-        y = cy - (2 * ptMargin.y) - (rcButton.bottom - rcButton.top);
-        x = cx - ptMarginGroup.x - (rcButton.right - rcButton.left);
-        if (!(dwp = DeferWindowPos(dwp,
-                                   hButton,
-                                   NULL,
-                                   x,
-                                   y,
-                                   0,
-                                   0,
-                                   SWP_NOSIZE | SWP_NOZORDER)))
-        {
-            return;
-        }
-
-        /* move the IDC_TROUBLESHOOT button */
-        hButton = GetDlgItem(hpd->hWnd,
-                             IDC_TROUBLESHOOT);
-        GetWindowRect(hButton,
-                      &rcButton);
-        x -= (ptMargin.x / 2) + (rcButton.right - rcButton.left);
-        if (!(dwp = DeferWindowPos(dwp,
-                                   hButton,
-                                   NULL,
-                                   x,
-                                   y,
-                                   0,
-                                   0,
-                                   SWP_NOSIZE | SWP_NOZORDER)))
-        {
-            return;
-        }
-
-        EndDeferWindowPos(dwp);
-    }
-}
-
-
-static VOID
-EnableTroubleShoot(PHARDWARE_PAGE_DATA hpd,
-                   BOOL Enable)
-{
-    HWND hBtnTroubleShoot = GetDlgItem(hpd->hWnd,
-                                       IDC_TROUBLESHOOT);
-
-    ShowWindow(hBtnTroubleShoot,
-               Enable ? SW_SHOW : SW_HIDE);
-}
-
-
-static INT_PTR
-CALLBACK
-HardwareDlgProc(IN HWND hwndDlg,
-                IN UINT uMsg,
-                IN WPARAM wParam,
-                IN LPARAM lParam)
-{
-    PHARDWARE_PAGE_DATA hpd;
-    INT_PTR Ret = FALSE;
-
-    hpd = (PHARDWARE_PAGE_DATA)GetWindowLongPtr(hwndDlg,
-                                                DWL_USER);
-
-    if (hpd != NULL || uMsg == WM_INITDIALOG)
-    {
-        switch (uMsg)
-        {
-            case WM_NOTIFY:
-            {
-                NMHDR *pnmh = (NMHDR*)lParam;
-                if (pnmh->hwndFrom == hpd->hWndDevList)
-                {
-                    switch (pnmh->code)
-                    {
-                        case LVN_ITEMCHANGED:
-                        {
-                            LPNMLISTVIEW pnmv = (LPNMLISTVIEW)lParam;
-
-                            if ((pnmv->uChanged & LVIF_STATE) &&
-                                ((pnmv->uOldState & (LVIS_FOCUSED | LVIS_SELECTED)) ||
-                                 (pnmv->uNewState & (LVIS_FOCUSED | LVIS_SELECTED))))
-                            {
-                                UpdateControlStates(hpd);
-                            }
-                            break;
-                        }
-
-                        case NM_DBLCLK:
-                        {
-                            DisplaySelectedDeviceProperties(hpd);
-                            break;
-                        }
-                    }
-                }
-                break;
-            }
-
-            case WM_COMMAND:
-            {
-                switch (LOWORD(wParam))
-                {
-                    case IDC_TROUBLESHOOT:
-                    {
-                        /* FIXME - start the help using the command in the window text */
-                        break;
-                    }
-
-                    case IDC_PROPERTIES:
-                    {
-                        DisplaySelectedDeviceProperties(hpd);
-                        break;
-                    }
-                }
-                break;
-            }
-
-            case WM_SIZE:
-                HardwareDlgResize(hpd,
-                                  (INT)LOWORD(lParam),
-                                  (INT)HIWORD(lParam));
-                break;
-
-            case WM_SETTEXT:
-            {
-                LPCWSTR szWndText = (LPCWSTR)lParam;
-                EnableTroubleShoot(hpd,
-                                   (szWndText != NULL && szWndText[0] != L'\0'));
-                break;
-            }
-
-            case WM_DEVICECHANGE:
-            {
-                /* FIXME - don't call UpdateDevicesListViewControl for all events */
-                UpdateDevicesListViewControl(hpd);
-                Ret = TRUE;
-                break;
-            }
-
-            case WM_INITDIALOG:
-            {
-                hpd = (PHARDWARE_PAGE_DATA)lParam;
-                if (hpd != NULL)
-                {
-                    HWND hWndParent;
-
-                    hpd->hWnd = hwndDlg;
-                    SetWindowLongPtr(hwndDlg,
-                                     DWL_USER,
-                                     (DWORD_PTR)hpd);
-
-                    hpd->ClassImageListData.cbSize = sizeof(SP_CLASSIMAGELIST_DATA);
-
-                    SetupDiGetClassImageList(&hpd->ClassImageListData);
-
-                    /* calculate the size of the devices list view control */
-                    hpd->hWndDevList = GetDlgItem(hwndDlg,
-                                                  IDC_LV_DEVICES);
-                    if (hpd->hWndDevList != NULL)
-                    {
-                        RECT rcClient;
-                        GetClientRect(hpd->hWndDevList,
-                                      &rcClient);
-                        hpd->DevListViewHeight = rcClient.bottom;
-
-                        if (hpd->DisplayMode == HWPD_LARGELIST)
-                        {
-                            hpd->DevListViewHeight = (hpd->DevListViewHeight * 3) / 2;
-                        }
-                    }
-
-                    /* subclass the parent window */
-                    hWndParent = GetAncestor(hwndDlg,
-                                             GA_PARENT);
-                    if (hWndParent != NULL)
-                    {
-                        RECT rcClient;
-
-                        if (GetClientRect(hWndParent,
-                                          &rcClient) &&
-                            SetWindowPos(hwndDlg,
-                                         NULL,
-                                         0,
-                                         0,
-                                         rcClient.right,
-                                         rcClient.bottom,
-                                         SWP_NOZORDER))
-                        {
-                            /* subclass the parent window. This is not safe
-                               if the parent window belongs to another thread! */
-                            hpd->ParentOldWndProc = (WNDPROC)SetWindowLongPtr(hWndParent,
-                                                                              GWLP_WNDPROC,
-                                                                              (LONG_PTR)ParentSubWndProc);
-
-                            if (hpd->ParentOldWndProc != NULL &&
-                                SetProp(hWndParent,
-                                        L"DevMgrSubClassInfo",
-                                        (HANDLE)hpd))
-                            {
-                                hpd->hWndParent = hWndParent;
-                            }
-                        }
-                    }
-
-                    /* initialize the devices list view control */
-                    InitializeDevicesList(hpd);
-
-                    /* fill the devices list view control */
-                    FillDevicesListViewControl(hpd,
-                                               NULL,
-                                               NULL);
-
-                    /* decide whether to show or hide the troubleshoot button */
-                    EnableTroubleShoot(hpd,
-                                       GetWindowTextLength(hwndDlg) != 0);
-                }
-                Ret = TRUE;
-                break;
-            }
-
-            case WM_DESTROY:
-            {
-                /* zero hpd pointer in window data, because it can be used later (WM_DESTROY has not to be last message) */
-                SetWindowLongPtr(hwndDlg, DWL_USER, (DWORD_PTR)NULL);
-                
-                /* free devices list */
-                FreeDevicesList(hpd);
-
-                /* restore the old window proc of the subclassed parent window */
-                if (hpd->hWndParent != NULL && hpd->ParentOldWndProc != NULL)
-                {
-                    SetWindowLongPtr(hpd->hWndParent,
-                                     GWLP_WNDPROC,
-                                     (LONG_PTR)hpd->ParentOldWndProc);
-                }
-
-                if (hpd->ClassImageListData.ImageList != NULL)
-                {
-                    SetupDiDestroyClassImageList(&hpd->ClassImageListData);
-                }
-
-                /* free the reference to comctl32 */
-                FreeLibrary(hpd->hComCtl32);
-                hpd->hComCtl32 = NULL;
-
-                /* free the allocated resources */
-                HeapFree(GetProcessHeap(),
-                         0,
-                         hpd);
-                break;
-            }
-        }
-    }
-
-    return Ret;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceCreateHardwarePageEx
- *
- * DESCRIPTION
- *   Creates a hardware page
- *
- * ARGUMENTS
- *   hWndParent:     Handle to the parent window
- *   lpGuids:        An array of guids of devices that are to be listed
- *   uNumberOfGuids: Numbers of guids in the Guids array
- *   DisplayMode:    Sets the size of the device list view control
- *
- * RETURN VALUE
- *   Returns the handle of the hardware page window that has been created or
- *   NULL if it failed.
- *
- * @implemented
- */
-HWND
-WINAPI
-DeviceCreateHardwarePageEx(IN HWND hWndParent,
-                           IN LPGUID lpGuids,
-                           IN UINT uNumberOfGuids,
-                           IN HWPAGE_DISPLAYMODE DisplayMode)
-{
-    PHARDWARE_PAGE_DATA hpd;
-
-    /* allocate the HARDWARE_PAGE_DATA structure. Make sure it is
-       zeroed because the initialization code assumes that in
-       failure cases! */
-    hpd = HeapAlloc(GetProcessHeap(),
-                    HEAP_ZERO_MEMORY,
-                    FIELD_OFFSET(HARDWARE_PAGE_DATA,
-                                 ClassDevInfo[uNumberOfGuids]));
-    if (hpd != NULL)
-    {
-        HWND hWnd;
-        UINT i;
-
-        hpd->DisplayMode = ((DisplayMode > HWPD_MAX) ? HWPD_STANDARDLIST : DisplayMode);
-
-        /* initialize the HARDWARE_PAGE_DATA structure */
-        hpd->NumberOfGuids = uNumberOfGuids;
-        for (i = 0;
-             i < uNumberOfGuids;
-             i++)
-        {
-            hpd->ClassDevInfo[i].hDevInfo = INVALID_HANDLE_VALUE;
-            hpd->ClassDevInfo[i].Guid = lpGuids[i];
-        }
-
-        /* load comctl32.dll dynamically */
-        hpd->hComCtl32 = LoadAndInitComctl32();
-        if (hpd->hComCtl32 == NULL)
-        {
-            goto Cleanup;
-        }
-
-        /* create the dialog */
-        hWnd = CreateDialogParam(hDllInstance,
-                                 MAKEINTRESOURCE(IDD_HARDWARE),
-                                 hWndParent,
-                                 HardwareDlgProc,
-                                 (LPARAM)hpd);
-        if (hWnd != NULL)
-        {
-            HeapFree(GetProcessHeap(), 0, hpd);
-            return hWnd;
-        }
-        else
-        {
-Cleanup:
-            /* oops, something went wrong... */
-            if (hpd->hComCtl32 != NULL)
-            {
-                FreeLibrary(hpd->hComCtl32);
-            }
-
-            HeapFree(GetProcessHeap(),
-                     0,
-                     hpd);
-        }
-    }
-
-    return NULL;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceCreateHardwarePage
- *
- * DESCRIPTION
- *   Creates a hardware page
- *
- * ARGUMENTS
- *   hWndParent: Handle to the parent window
- *   lpGuid:     Guid of the device
- *
- * RETURN VALUE
- *   Returns the handle of the hardware page window that has been created or
- *   NULL if it failed.
- *
- * @implemented
- */
-HWND
-WINAPI
-DeviceCreateHardwarePage(IN HWND hWndParent,
-                         IN LPGUID lpGuid)
-{
-    return DeviceCreateHardwarePageEx(hWndParent,
-                                      lpGuid,
-                                      1,
-                                      HWPD_LARGELIST);
-}
diff --git a/dll/win32/devmgr/hwresource.c b/dll/win32/devmgr/hwresource.c
deleted file mode 100644 (file)
index fcc8095..0000000
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * PROJECT:         ReactOS devmgr.dll
- * FILE:            dll/win32/devmgr/hwresource.c
- * PURPOSE:         ReactOS Device Manager
- * PROGRAMMER:      Johannes Anderwald <johannes.anderwald@reactos.org>
- * UPDATE HISTORY:
- *      2005/11/24  Created
- */
-
-#include "precomp.h"
-
-
-typedef struct
-{
-    HWND hWnd;
-    HWND hWndDevList;
-
-
-}HARDWARE_RESOURCE_DATA, *PHARDWARE_RESOURCE_DATA;
-
-/* Physical Addresses are always treated as 64-bit wide */
-typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
-
-#include <pshpack4.h>
-typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
-  UCHAR Type;
-  UCHAR ShareDisposition;
-  USHORT Flags;
-  union {
-    struct {
-      PHYSICAL_ADDRESS Start;
-      ULONG Length;
-    } Generic;
-    struct {
-      PHYSICAL_ADDRESS Start;
-      ULONG Length;
-    } Port;
-    struct {
-#if defined(NT_PROCESSOR_GROUPS)
-      USHORT Level;
-      USHORT Group;
-#else
-      ULONG Level;
-#endif
-      ULONG Vector;
-      KAFFINITY Affinity;
-    } Interrupt;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-    struct {
-      _ANONYMOUS_UNION union {
-        struct {
-#if defined(NT_PROCESSOR_GROUPS)
-          USHORT Group;
-#else
-          USHORT Reserved;
-#endif
-          USHORT MessageCount;
-          ULONG Vector;
-          KAFFINITY Affinity;
-        } Raw;
-        struct {
-#if defined(NT_PROCESSOR_GROUPS)
-          USHORT Level;
-          USHORT Group;
-#else
-          ULONG Level;
-#endif
-          ULONG Vector;
-          KAFFINITY Affinity;
-        } Translated;
-      } DUMMYUNIONNAME;
-    } MessageInterrupt;
-#endif
-    struct {
-      PHYSICAL_ADDRESS Start;
-      ULONG Length;
-    } Memory;
-    struct {
-      ULONG Channel;
-      ULONG Port;
-      ULONG Reserved1;
-    } Dma;
-    struct {
-      ULONG Data[3];
-    } DevicePrivate;
-    struct {
-      ULONG Start;
-      ULONG Length;
-      ULONG Reserved;
-    } BusNumber;
-    struct {
-      ULONG DataSize;
-      ULONG Reserved1;
-      ULONG Reserved2;
-    } DeviceSpecificData;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-    struct {
-      PHYSICAL_ADDRESS Start;
-      ULONG Length40;
-    } Memory40;
-    struct {
-      PHYSICAL_ADDRESS Start;
-      ULONG Length48;
-    } Memory48;
-    struct {
-      PHYSICAL_ADDRESS Start;
-      ULONG Length64;
-    } Memory64;
-#endif
-  } u;
-} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
-#include <poppack.h>
-typedef struct _CM_PARTIAL_RESOURCE_LIST {
-  USHORT Version;
-  USHORT Revision;
-  ULONG Count;
-  CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
-} CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
-
-#define CmResourceTypeNull              0
-#define CmResourceTypePort              1
-#define CmResourceTypeInterrupt         2
-#define CmResourceTypeMemory            3
-#define CmResourceTypeDma               4
-#define CmResourceTypeDeviceSpecific    5
-#define CmResourceTypeBusNumber         6
-#define CmResourceTypeNonArbitrated     128
-#define CmResourceTypeConfigData        128
-#define CmResourceTypeDevicePrivate     129
-#define CmResourceTypePcCardConfig      130
-#define CmResourceTypeMfCardConfig      131
-
-typedef enum _INTERFACE_TYPE {
-  InterfaceTypeUndefined = -1,
-  Internal,
-  Isa,
-  Eisa,
-  MicroChannel,
-  TurboChannel,
-  PCIBus,
-  VMEBus,
-  NuBus,
-  PCMCIABus,
-  CBus,
-  MPIBus,
-  MPSABus,
-  ProcessorInternal,
-  InternalPowerBus,
-  PNPISABus,
-  PNPBus,
-  Vmcs,
-  MaximumInterfaceType
-} INTERFACE_TYPE, *PINTERFACE_TYPE;
-
-typedef struct _CM_FULL_RESOURCE_DESCRIPTOR {
-  INTERFACE_TYPE InterfaceType;
-  ULONG BusNumber;
-  CM_PARTIAL_RESOURCE_LIST PartialResourceList;
-} CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
-
-typedef struct _CM_RESOURCE_LIST {
-  ULONG                       Count;
-  CM_FULL_RESOURCE_DESCRIPTOR List[1];
-} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
-
-
-#define CX_TYPECOLUMN_WIDTH 120
-
-static VOID
-InitializeDevicesList(
-    IN HWND hWndDevList)
-{
-    LVCOLUMN lvc;
-    RECT rcClient;
-    WCHAR szColName[255];
-    int iCol = 0;
-
-    /* set the list view style */
-    (void)ListView_SetExtendedListViewStyle(hWndDevList,
-                                            LVS_EX_FULLROWSELECT);
-
-    GetClientRect(hWndDevList,
-                  &rcClient);
-
-    /* add the list view columns */
-    lvc.mask = LVCF_TEXT | LVCF_WIDTH;
-    lvc.fmt = LVCFMT_LEFT;
-    lvc.pszText = szColName;
-
-    if (LoadString(hDllInstance,
-                   IDS_RESOURCE_COLUMN,
-                   szColName,
-                   sizeof(szColName) / sizeof(szColName[0])))
-    {
-        lvc.cx = CX_TYPECOLUMN_WIDTH;
-        (void)ListView_InsertColumn(hWndDevList,
-                                    iCol++,
-                                    &lvc);
-    }
-    if (LoadString(hDllInstance,
-                   IDS_SETTING_COLUMN,
-                   szColName,
-                   sizeof(szColName) / sizeof(szColName[0])))
-    {
-        lvc.cx = rcClient.right - CX_TYPECOLUMN_WIDTH -
-                 GetSystemMetrics(SM_CXVSCROLL);
-
-        (void)ListView_InsertColumn(hWndDevList,
-                                    iCol++,
-                                    &lvc);
-    }
-}
-
-VOID
-InsertListItem(
-    IN HWND hWndDevList,
-    IN INT ItemCount,
-    IN LPWSTR ResourceType,
-    IN LPWSTR ResourceDescription)
-{
-    INT iItem;
-    LVITEM li = {0};
-
-    li.mask = LVIF_STATE | LVIF_TEXT;
-    li.iItem = ItemCount;
-    li.pszText = ResourceType;
-    //li.iImage = ClassDevInfo->ImageIndex;
-    iItem = ListView_InsertItem(hWndDevList, &li);
-
-    if (iItem != -1)
-    {
-        li.mask = LVIF_TEXT;
-        li.iItem = iItem;
-        li.iSubItem = 1;
-        li.pszText = ResourceDescription;
-        (void)ListView_SetItem(hWndDevList, &li);
-    }
-}
-
-VOID
-AddResourceItems(
-    IN PDEVADVPROP_INFO dap,
-    IN HWND hWndDevList)
-{
-    HKEY hKey;
-    WCHAR szBuffer[100];
-    WCHAR szDetail[100];
-    BYTE szData[512];
-    DWORD dwSize;
-    PCM_RESOURCE_LIST ResourceList;
-    LONG Result;
-    ULONG ItemCount = 0, Index;
-
-    wsprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Enum\\%s\\LogConf", dap->szDeviceID);
-    Result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 0, KEY_READ, &hKey);
-    if (Result != ERROR_SUCCESS)
-    {
-        /* failed to open device instance log conf dir */
-        return;
-    }
-
-    dwSize = sizeof(szData);
-    Result = RegQueryValueExW(hKey, L"BootConfig", NULL, NULL, szData, &dwSize);
-
-    RegCloseKey(hKey);
-    if (Result != ERROR_SUCCESS)
-    {
-        /* failed to query resources */
-        return;
-    }
-
-    ResourceList = (PCM_RESOURCE_LIST)szData;
-
-    for (Index = 0; Index < ResourceList->List[0].PartialResourceList.Count; Index++)
-    {
-         PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[Index];
-         if (Descriptor->Type == CmResourceTypeInterrupt)
-         {
-             if (LoadString(hDllInstance, IDS_RESOURCE_INTERRUPT, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])))
-             {
-                 wsprintf(szDetail, L"0x%08x (%d)", Descriptor->u.Interrupt.Level, Descriptor->u.Interrupt.Vector);
-                 InsertListItem(hWndDevList, ItemCount, szBuffer, szDetail);
-                 ItemCount++;
-             }
-         }
-         else if (Descriptor->Type == CmResourceTypePort)
-         {
-             if (LoadString(hDllInstance, IDS_RESOURCE_PORT, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])))
-             {
-                 wsprintf(szDetail, L"%08lx - %08lx", Descriptor->u.Port.Start.LowPart, Descriptor->u.Port.Start.LowPart + Descriptor->u.Port.Length - 1);
-                 InsertListItem(hWndDevList, ItemCount, szBuffer, szDetail);
-                 ItemCount++;
-             }
-         }
-         else if (Descriptor->Type == CmResourceTypeMemory)
-         {
-             if (LoadString(hDllInstance, IDS_RESOURCE_MEMORY_RANGE, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])))
-             {
-                 wsprintf(szDetail, L"%08I64x - %08I64x", Descriptor->u.Memory.Start.QuadPart, Descriptor->u.Memory.Start.QuadPart + Descriptor->u.Memory.Length - 1);
-                 InsertListItem(hWndDevList, ItemCount, szBuffer, szDetail);
-                 ItemCount++;
-             }
-         }
-         else if (Descriptor->Type == CmResourceTypeDma)
-         {
-             if (LoadString(hDllInstance, IDS_RESOURCE_DMA, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])))
-             {
-                 wsprintf(szDetail, L"%08ld", Descriptor->u.Dma.Channel);
-                 InsertListItem(hWndDevList, ItemCount, szBuffer, szDetail);
-                 ItemCount++;
-             }
-         }
-    }
-}
-
-
-static VOID
-UpdateDriverResourceDlg(IN HWND hwndDlg,
-                        IN PDEVADVPROP_INFO dap)
-{
-    /* set the device image */
-    SendDlgItemMessage(hwndDlg,
-                       IDC_DEVICON,
-                       STM_SETICON,
-                       (WPARAM)dap->hDevIcon,
-                       0);
-
-    /* set the device name edit control text */
-    SetDlgItemText(hwndDlg,
-                   IDC_DEVNAME,
-                   dap->szDevName);
-}
-
-INT_PTR
-CALLBACK
-ResourcesProcDriverDlgProc(IN HWND hwndDlg,
-                     IN UINT uMsg,
-                     IN WPARAM wParam,
-                     IN LPARAM lParam)
-{
-    PDEVADVPROP_INFO hpd;
-    HWND hWndDevList;
-    INT_PTR Ret = FALSE;
-
-    hpd = (PDEVADVPROP_INFO)GetWindowLongPtr(hwndDlg,
-                                                DWL_USER);
-
-    if (hpd != NULL || uMsg == WM_INITDIALOG)
-    {
-        switch (uMsg)
-        {
-            case WM_INITDIALOG:
-            {
-                /* init list */
-                hWndDevList = GetDlgItem(hwndDlg, IDC_DRIVERRESOURCES);
-                InitializeDevicesList(hWndDevList);
-
-                hpd = (PDEVADVPROP_INFO)((LPPROPSHEETPAGE)lParam)->lParam;
-                if (hpd != NULL)
-                {
-                    SetWindowLongPtr(hwndDlg,
-                                     DWL_USER,
-                                     (DWORD_PTR)hpd);
-
-                    SetWindowLongPtr(hwndDlg,
-                                     DWL_USER,
-                                     (DWORD_PTR)hpd);
-
-                    UpdateDriverResourceDlg(hwndDlg, hpd);
-                    AddResourceItems(hpd, hWndDevList);
-                }
-
-                Ret = TRUE;
-                break;
-            }
-        }
-    }
-
-    return Ret;
-}
-
diff --git a/dll/win32/devmgr/misc.c b/dll/win32/devmgr/misc.c
deleted file mode 100644 (file)
index 1ecc44c..0000000
+++ /dev/null
@@ -1,1147 +0,0 @@
-/*
- * ReactOS Device Manager Applet
- * Copyright (C) 2004 - 2005 ReactOS Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-/*
- * PROJECT:         ReactOS devmgr.dll
- * FILE:            lib/devmgr/misc.c
- * PURPOSE:         ReactOS Device Manager
- * PROGRAMMER:      Thomas Weidenmueller <w3seek@reactos.com>
- * UPDATE HISTORY:
- *      2005/11/24  Created
- */
-
-#include "precomp.h"
-
-
-HINSTANCE hDllInstance = NULL;
-
-INT
-LengthOfStrResource(IN HINSTANCE hInst,
-                    IN UINT uID)
-{
-    HRSRC hrSrc;
-    HGLOBAL hRes;
-    LPWSTR lpName, lpStr;
-
-    if (hInst == NULL)
-    {
-        return -1;
-    }
-
-    /* There are always blocks of 16 strings */
-    lpName = (LPWSTR)MAKEINTRESOURCE((uID >> 4) + 1);
-
-    /* Find the string table block */
-    if ((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) &&
-        (hRes = LoadResource(hInst, hrSrc)) &&
-        (lpStr = LockResource(hRes)))
-    {
-        UINT x;
-
-        /* Find the string we're looking for */
-        uID &= 0xF; /* position in the block, same as % 16 */
-        for (x = 0; x < uID; x++)
-        {
-            lpStr += (*lpStr) + 1;
-        }
-
-        /* Found the string */
-        return (int)(*lpStr);
-    }
-    return -1;
-}
-
-
-static INT
-AllocAndLoadString(OUT LPWSTR *lpTarget,
-                   IN HINSTANCE hInst,
-                   IN UINT uID)
-{
-    INT ln;
-
-    ln = LengthOfStrResource(hInst,
-                             uID);
-    if (ln++ > 0)
-    {
-        (*lpTarget) = (LPWSTR)LocalAlloc(LMEM_FIXED,
-                                         ln * sizeof(WCHAR));
-        if ((*lpTarget) != NULL)
-        {
-            INT Ret;
-            if (!(Ret = LoadStringW(hInst, uID, *lpTarget, ln)))
-            {
-                LocalFree((HLOCAL)(*lpTarget));
-            }
-            return Ret;
-        }
-    }
-    return 0;
-}
-
-
-static INT
-AllocAndLoadStringsCat(OUT LPWSTR *lpTarget,
-                       IN HINSTANCE hInst,
-                       IN UINT *uID,
-                       IN UINT nIDs)
-{
-    INT ln = 0;
-    UINT i;
-
-    for (i = 0;
-         i != nIDs;
-         i++)
-    {
-        ln += LengthOfStrResource(hInst,
-                                  uID[i]);
-    }
-
-    if (ln != 0)
-    {
-        (*lpTarget) = (LPWSTR)LocalAlloc(LMEM_FIXED,
-                                         (ln + 1) * sizeof(WCHAR));
-        if ((*lpTarget) != NULL)
-        {
-            LPWSTR s = *lpTarget;
-            INT Ret = 0;
-
-            for (i = 0;
-                 i != nIDs;
-                 i++)
-            {
-                if (!(Ret = LoadStringW(hInst, uID[i], s, ln)))
-                {
-                    LocalFree((HLOCAL)(*lpTarget));
-                    return 0;
-                }
-
-                s += Ret;
-            }
-
-            return s - *lpTarget;
-        }
-    }
-    return 0;
-}
-
-
-DWORD
-LoadAndFormatString(IN HINSTANCE hInstance,
-                    IN UINT uID,
-                    OUT LPWSTR *lpTarget,
-                    ...)
-{
-    DWORD Ret = 0;
-    LPWSTR lpFormat;
-    va_list lArgs;
-
-    if (AllocAndLoadString(&lpFormat,
-                           hInstance,
-                           uID) != 0)
-    {
-        va_start(lArgs, lpTarget);
-        /* let's use FormatMessage to format it because it has the ability to allocate
-           memory automatically */
-        Ret = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
-                             lpFormat,
-                             0,
-                             0,
-                             (LPWSTR)lpTarget,
-                             0,
-                             &lArgs);
-        va_end(lArgs);
-
-        LocalFree((HLOCAL)lpFormat);
-    }
-
-    return Ret;
-}
-
-
-DWORD
-LoadAndFormatStringsCat(IN HINSTANCE hInstance,
-                        IN UINT *uID,
-                        IN UINT nIDs,
-                        OUT LPWSTR *lpTarget,
-                        ...)
-{
-    DWORD Ret = 0;
-    LPWSTR lpFormat;
-    va_list lArgs;
-
-    if (AllocAndLoadStringsCat(&lpFormat,
-                               hInstance,
-                               uID,
-                               nIDs) != 0)
-    {
-        va_start(lArgs, lpTarget);
-        /* let's use FormatMessage to format it because it has the ability to allocate
-           memory automatically */
-        Ret = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
-                             lpFormat,
-                             0,
-                             0,
-                             (LPWSTR)lpTarget,
-                             0,
-                             &lArgs);
-        va_end(lArgs);
-
-        LocalFree((HLOCAL)lpFormat);
-    }
-
-    return Ret;
-}
-
-
-LPARAM
-ListViewGetSelectedItemData(IN HWND hwnd)
-{
-    int Index;
-
-    Index = ListView_GetNextItem(hwnd,
-                                 -1,
-                                 LVNI_SELECTED);
-    if (Index != -1)
-    {
-        LVITEM li;
-
-        li.mask = LVIF_PARAM;
-        li.iItem = Index;
-        li.iSubItem = 0;
-
-        if (ListView_GetItem(hwnd,
-                             &li))
-        {
-            return li.lParam;
-        }
-    }
-
-    return 0;
-}
-
-
-LPWSTR
-ConvertMultiByteToUnicode(IN LPCSTR lpMultiByteStr,
-                          IN UINT uCodePage)
-{
-    LPWSTR lpUnicodeStr;
-    INT nLength;
-
-    nLength = MultiByteToWideChar(uCodePage,
-                                  0,
-                                  lpMultiByteStr,
-                                  -1,
-                                  NULL,
-                                  0);
-    if (nLength == 0)
-        return NULL;
-
-    lpUnicodeStr = HeapAlloc(GetProcessHeap(),
-                             0,
-                             nLength * sizeof(WCHAR));
-    if (lpUnicodeStr == NULL)
-    {
-        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-        return NULL;
-    }
-
-    if (!MultiByteToWideChar(uCodePage,
-                             0,
-                             lpMultiByteStr,
-                             nLength,
-                             lpUnicodeStr,
-                             nLength))
-    {
-        HeapFree(GetProcessHeap(),
-                 0,
-                 lpUnicodeStr);
-        return NULL;
-    }
-
-    return lpUnicodeStr;
-}
-
-
-BOOL
-GetDeviceManufacturerString(IN HDEVINFO DeviceInfoSet,
-                            IN PSP_DEVINFO_DATA DeviceInfoData,
-                            OUT LPWSTR szBuffer,
-                            IN DWORD BufferSize)
-{
-    DWORD RegDataType;
-    BOOL Ret = FALSE;
-
-    if (!SetupDiGetDeviceRegistryProperty(DeviceInfoSet,
-                                          DeviceInfoData,
-                                          SPDRP_MFG,
-                                          &RegDataType,
-                                          (PBYTE)szBuffer,
-                                          BufferSize * sizeof(WCHAR),
-                                          NULL) ||
-        RegDataType != REG_SZ)
-    {
-        szBuffer[0] = L'\0';
-        if (LoadString(hDllInstance,
-                       IDS_UNKNOWN,
-                       szBuffer,
-                       BufferSize))
-        {
-            Ret = TRUE;
-        }
-    }
-    else
-    {
-        /* FIXME - check string for NULL termination! */
-        Ret = TRUE;
-    }
-
-    return Ret;
-}
-
-
-BOOL
-GetDeviceLocationString(IN HDEVINFO DeviceInfoSet,
-                        IN PSP_DEVINFO_DATA DeviceInfoData,
-                        IN DEVINST dnParentDevInst  OPTIONAL,
-                        OUT LPWSTR szBuffer,
-                        IN DWORD BufferSize)
-{
-    DWORD RegDataType;
-    ULONG DataSize;
-    CONFIGRET cRet;
-    LPWSTR szFormatted;
-    HKEY hKey;
-    DWORD dwSize, dwType;
-    BOOL Ret = FALSE;
-
-    DataSize = BufferSize * sizeof(WCHAR);
-    szBuffer[0] = L'\0';
-
-    hKey = SetupDiOpenDevRegKey(DeviceInfoSet,
-                                DeviceInfoData,
-                                DICS_FLAG_GLOBAL,
-                                0,
-                                DIREG_DRV,
-                                KEY_QUERY_VALUE);
-    if (hKey != INVALID_HANDLE_VALUE)
-    {
-        /* query the LocationInformationOverride value */
-        dwSize = BufferSize;
-        if (RegQueryValueEx(hKey,
-                            L"LocationInformationOverride",
-                            NULL,
-                            &dwType,
-                            (LPBYTE)szBuffer,
-                            &dwSize) == ERROR_SUCCESS &&
-            dwType == REG_SZ &&
-            szBuffer[0] != L'\0')
-        {
-            Ret = TRUE;
-        }
-        else
-        {
-            szBuffer[0] = L'\0';
-        }
-
-        RegCloseKey(hKey);
-    }
-
-
-    if (!Ret)
-    {
-        if (dnParentDevInst != 0)
-        {
-            /* query the parent node name */
-            if (CM_Get_DevNode_Registry_Property(dnParentDevInst,
-                                                 CM_DRP_DEVICEDESC,
-                                                 &RegDataType,
-                                                 szBuffer,
-                                                 &DataSize,
-                                                 0) == CR_SUCCESS &&
-                 RegDataType == REG_SZ &&
-                 LoadAndFormatString(hDllInstance,
-                                     IDS_DEVONPARENT,
-                                     &szFormatted,
-                                     szBuffer) != 0)
-            {
-                wcsncpy(szBuffer,
-                        szFormatted,
-                        BufferSize - 1);
-                szBuffer[BufferSize - 1] = L'\0';
-                LocalFree((HLOCAL)szFormatted);
-                Ret = TRUE;
-            }
-        }
-        else if (DeviceInfoData->DevInst != 0)
-        {
-            cRet = CM_Get_DevNode_Registry_Property(DeviceInfoData->DevInst,
-                                                    CM_DRP_LOCATION_INFORMATION,
-                                                    &RegDataType,
-                                                    szBuffer,
-                                                    &DataSize,
-                                                    0);
-            if (cRet == CR_SUCCESS && RegDataType == REG_SZ)
-            {
-                /* FIXME - check string for NULL termination! */
-                Ret = TRUE;
-            }
-
-            if (Ret && szBuffer[0] >= L'0' && szBuffer[0] <= L'9')
-            {
-                /* convert the string to an integer value and create a
-                   formatted string */
-                ULONG ulLocation = (ULONG)wcstoul(szBuffer,
-                                                  NULL,
-                                                  10);
-                if (LoadAndFormatString(hDllInstance,
-                                        IDS_LOCATIONSTR,
-                                        &szFormatted,
-                                        ulLocation,
-                                        szBuffer) != 0)
-                {
-                    wcsncpy(szBuffer,
-                            szFormatted,
-                            BufferSize - 1);
-                    szBuffer[BufferSize - 1] = L'\0';
-                    LocalFree((HLOCAL)szFormatted);
-                }
-                else
-                    Ret = FALSE;
-            }
-        }
-    }
-
-    if (!Ret &&
-        LoadString(hDllInstance,
-                   IDS_UNKNOWN,
-                   szBuffer,
-                   BufferSize))
-    {
-        Ret = TRUE;
-    }
-
-    return Ret;
-}
-
-
-BOOL
-GetDeviceStatusString(IN DEVINST DevInst,
-                      IN HMACHINE hMachine,
-                      OUT LPWSTR szBuffer,
-                      IN DWORD BufferSize)
-{
-    CONFIGRET cr;
-    ULONG Status, ProblemNumber;
-    UINT MessageId = IDS_UNKNOWN;
-    BOOL Ret = FALSE;
-
-    szBuffer[0] = L'\0';
-    cr = CM_Get_DevNode_Status_Ex(&Status,
-                                  &ProblemNumber,
-                                  DevInst,
-                                  0,
-                                  hMachine);
-    if (cr == CR_SUCCESS)
-    {
-        if (Status & DN_HAS_PROBLEM)
-        {
-            UINT uRet;
-
-            uRet = DeviceProblemText(hMachine,
-                                     DevInst,
-                                     ProblemNumber,
-                                     szBuffer,
-                                     (BufferSize != 0 ? BufferSize : BufferSize - 1));
-
-            Ret = (uRet != 0 && uRet < BufferSize);
-        }
-        else
-        {
-            if (!(Status & (DN_DRIVER_LOADED | DN_STARTED)))
-            {
-                MessageId = IDS_NODRIVERLOADED;
-            }
-            else
-            {
-                MessageId = IDS_DEV_NO_PROBLEM;
-            }
-
-            goto GeneralMessage;
-        }
-    }
-    else
-    {
-GeneralMessage:
-        if (LoadString(hDllInstance,
-                        MessageId,
-                        szBuffer,
-                        (int)BufferSize))
-        {
-            Ret = TRUE;
-        }
-    }
-
-    return Ret;
-}
-
-
-BOOL
-GetDriverProviderString(IN HDEVINFO DeviceInfoSet,
-                        IN PSP_DEVINFO_DATA DeviceInfoData,
-                        OUT LPWSTR szBuffer,
-                        IN DWORD BufferSize)
-{
-    HKEY hKey;
-    DWORD dwSize, dwType;
-    BOOL Ret = FALSE;
-
-    szBuffer[0] = L'\0';
-
-    /* get driver provider, date and version */
-    hKey = SetupDiOpenDevRegKey(DeviceInfoSet,
-                                DeviceInfoData,
-                                DICS_FLAG_GLOBAL,
-                                0,
-                                DIREG_DRV,
-                                KEY_QUERY_VALUE);
-    if (hKey != INVALID_HANDLE_VALUE)
-    {
-        /* query the driver provider */
-        dwSize = BufferSize;
-        if (RegQueryValueEx(hKey,
-                            REGSTR_VAL_PROVIDER_NAME,
-                            NULL,
-                            &dwType,
-                            (LPBYTE)szBuffer,
-                            &dwSize) == ERROR_SUCCESS &&
-            dwType == REG_SZ &&
-            szBuffer[0] != L'\0')
-        {
-            Ret = TRUE;
-        }
-        else
-        {
-            szBuffer[0] = L'\0';
-        }
-
-        RegCloseKey(hKey);
-    }
-
-    if (szBuffer[0] == L'\0')
-    {
-        /* unable to query the information */
-        if (LoadString(hDllInstance,
-                       IDS_UNKNOWN,
-                       szBuffer,
-                       BufferSize))
-        {
-            Ret = TRUE;
-        }
-    }
-
-    return Ret;
-}
-
-
-BOOL
-GetDriverVersionString(IN HDEVINFO DeviceInfoSet,
-                       IN PSP_DEVINFO_DATA DeviceInfoData,
-                       OUT LPWSTR szBuffer,
-                       IN DWORD BufferSize)
-{
-    HKEY hKey;
-    DWORD dwSize, dwType;
-    BOOL Ret = FALSE;
-
-    szBuffer[0] = L'\0';
-
-    /* get driver provider, date and version */
-    hKey = SetupDiOpenDevRegKey(DeviceInfoSet,
-                                DeviceInfoData,
-                                DICS_FLAG_GLOBAL,
-                                0,
-                                DIREG_DRV,
-                                KEY_QUERY_VALUE);
-    if (hKey != INVALID_HANDLE_VALUE)
-    {
-        /* query the driver provider */
-        dwSize = BufferSize;
-        if (RegQueryValueEx(hKey,
-                            L"DriverVersion",
-                            NULL,
-                            &dwType,
-                            (LPBYTE)szBuffer,
-                            &dwSize) == ERROR_SUCCESS &&
-            dwType == REG_SZ &&
-            szBuffer[0] != L'\0')
-        {
-            Ret = TRUE;
-        }
-        else
-        {
-            szBuffer[0] = L'\0';
-        }
-
-        RegCloseKey(hKey);
-    }
-
-    if (szBuffer[0] == L'\0')
-    {
-        /* unable to query the information */
-        if (LoadString(hDllInstance,
-                       IDS_NOTAVAILABLE,
-                       szBuffer,
-                       BufferSize))
-        {
-            Ret = TRUE;
-        }
-    }
-
-    return Ret;
-}
-
-BOOL
-GetDriverDateString(IN HDEVINFO DeviceInfoSet,
-                    IN PSP_DEVINFO_DATA DeviceInfoData,
-                    OUT LPWSTR szBuffer,
-                    IN DWORD BufferSize)
-{
-    HKEY hKey;
-    FILETIME DriverDate;
-    SYSTEMTIME SystemTime, LocalTime;
-    DWORD dwSize, dwType;
-    BOOL Ret = FALSE;
-
-    szBuffer[0] = L'\0';
-
-    /* get driver provider, date and version */
-    hKey = SetupDiOpenDevRegKey(DeviceInfoSet,
-                                DeviceInfoData,
-                                DICS_FLAG_GLOBAL,
-                                0,
-                                DIREG_DRV,
-                                KEY_QUERY_VALUE);
-    if (hKey != INVALID_HANDLE_VALUE)
-    {
-        /* query the driver provider */
-        dwSize = sizeof(FILETIME);
-        if (RegQueryValueEx(hKey,
-                            L"DriverDateData",
-                            NULL,
-                            &dwType,
-                            (LPBYTE)&DriverDate,
-                            &dwSize) == ERROR_SUCCESS &&
-            dwType == REG_BINARY &&
-            dwSize == sizeof(FILETIME) &&
-            FileTimeToSystemTime(&DriverDate,
-                                 &SystemTime) &&
-            SystemTimeToTzSpecificLocalTime(NULL,
-                                            &SystemTime,
-                                            &LocalTime) &&
-            GetDateFormat(LOCALE_USER_DEFAULT,
-                          DATE_SHORTDATE,
-                          &LocalTime,
-                          NULL,
-                          szBuffer,
-                          BufferSize) != 0)
-        {
-            Ret = TRUE;
-        }
-
-        RegCloseKey(hKey);
-    }
-
-    if (!Ret)
-    {
-        /* unable to query the information */
-        if (LoadString(hDllInstance,
-                       IDS_NOTAVAILABLE,
-                       szBuffer,
-                       BufferSize))
-        {
-            Ret = TRUE;
-        }
-    }
-
-    return Ret;
-}
-
-
-
-BOOL
-IsDeviceHidden(IN DEVINST DevInst,
-               IN HMACHINE hMachine,
-               OUT BOOL *IsHidden)
-{
-    CONFIGRET cr;
-    ULONG Status, ProblemNumber;
-    BOOL Ret = FALSE;
-
-    cr = CM_Get_DevNode_Status_Ex(&Status,
-                                  &ProblemNumber,
-                                  DevInst,
-                                  0,
-                                  hMachine);
-    if (cr == CR_SUCCESS)
-    {
-        *IsHidden = ((Status & DN_NO_SHOW_IN_DM) != 0);
-        Ret = TRUE;
-    }
-
-    return Ret;
-}
-
-
-BOOL
-CanDisableDevice(IN DEVINST DevInst,
-                 IN HMACHINE hMachine,
-                 OUT BOOL *CanDisable)
-{
-    CONFIGRET cr;
-    ULONG Status, ProblemNumber;
-    BOOL Ret = FALSE;
-
-    cr = CM_Get_DevNode_Status_Ex(&Status,
-                                  &ProblemNumber,
-                                  DevInst,
-                                  0,
-                                  hMachine);
-    if (cr == CR_SUCCESS)
-    {
-        *CanDisable = ((Status & DN_DISABLEABLE) != 0);
-        Ret = TRUE;
-    }
-
-    return Ret;
-}
-
-
-BOOL
-IsDeviceStarted(IN DEVINST DevInst,
-                IN HMACHINE hMachine,
-                OUT BOOL *IsStarted)
-{
-    CONFIGRET cr;
-    ULONG Status, ProblemNumber;
-    BOOL Ret = FALSE;
-
-    cr = CM_Get_DevNode_Status_Ex(&Status,
-                                  &ProblemNumber,
-                                  DevInst,
-                                  0,
-                                  hMachine);
-    if (cr == CR_SUCCESS)
-    {
-        *IsStarted = ((Status & DN_STARTED) != 0);
-        Ret = TRUE;
-    }
-
-    return Ret;
-}
-
-
-BOOL
-IsDriverInstalled(IN DEVINST DevInst,
-                  IN HMACHINE hMachine,
-                  OUT BOOL *Installed)
-{
-    CONFIGRET cr;
-    ULONG Status, ProblemNumber;
-    BOOL Ret = FALSE;
-
-    cr = CM_Get_DevNode_Status_Ex(&Status,
-                                  &ProblemNumber,
-                                  DevInst,
-                                  0,
-                                  hMachine);
-    if (cr == CR_SUCCESS)
-    {
-        *Installed = ((Status & DN_HAS_PROBLEM) != 0 ||
-                      (Status & (DN_DRIVER_LOADED | DN_STARTED)) != 0);
-        Ret = TRUE;
-    }
-
-    return Ret;
-}
-
-
-BOOL
-EnableDevice(IN HDEVINFO DeviceInfoSet,
-             IN PSP_DEVINFO_DATA DevInfoData  OPTIONAL,
-             IN BOOL bEnable,
-             IN DWORD HardwareProfile  OPTIONAL,
-             OUT BOOL *bNeedReboot  OPTIONAL)
-{
-    SP_PROPCHANGE_PARAMS pcp;
-    SP_DEVINSTALL_PARAMS dp;
-    DWORD LastErr;
-    BOOL Ret = FALSE;
-
-    pcp.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
-    pcp.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
-    pcp.HwProfile = HardwareProfile;
-
-    if (bEnable)
-    {
-        /* try to enable the device on the global profile */
-        pcp.StateChange = DICS_ENABLE;
-        pcp.Scope = DICS_FLAG_GLOBAL;
-
-        /* ignore errors */
-        LastErr = GetLastError();
-        if (SetupDiSetClassInstallParams(DeviceInfoSet,
-                                         DevInfoData,
-                                         &pcp.ClassInstallHeader,
-                                         sizeof(SP_PROPCHANGE_PARAMS)))
-        {
-            SetupDiCallClassInstaller(DIF_PROPERTYCHANGE,
-                                      DeviceInfoSet,
-                                      DevInfoData);
-        }
-        SetLastError(LastErr);
-    }
-
-    /* try config-specific */
-    pcp.StateChange = (bEnable ? DICS_ENABLE : DICS_DISABLE);
-    pcp.Scope = DICS_FLAG_CONFIGSPECIFIC;
-
-    if (SetupDiSetClassInstallParams(DeviceInfoSet,
-                                     DevInfoData,
-                                     &pcp.ClassInstallHeader,
-                                     sizeof(SP_PROPCHANGE_PARAMS)) &&
-        SetupDiCallClassInstaller(DIF_PROPERTYCHANGE,
-                                  DeviceInfoSet,
-                                  DevInfoData))
-    {
-        dp.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
-        if (SetupDiGetDeviceInstallParams(DeviceInfoSet,
-                                          DevInfoData,
-                                          &dp))
-        {
-            if (bNeedReboot != NULL)
-            {
-                *bNeedReboot = ((dp.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT)) != 0);
-            }
-
-            Ret = TRUE;
-        }
-    }
-    return Ret;
-}
-
-
-BOOL
-GetDeviceTypeString(IN PSP_DEVINFO_DATA DeviceInfoData,
-                    OUT LPWSTR szBuffer,
-                    IN DWORD BufferSize)
-{
-    BOOL Ret = FALSE;
-
-    if (!SetupDiGetClassDescription(&DeviceInfoData->ClassGuid,
-                                    szBuffer,
-                                    BufferSize,
-                                    NULL))
-    {
-        szBuffer[0] = L'\0';
-        if (LoadString(hDllInstance,
-                       IDS_UNKNOWN,
-                       szBuffer,
-                       BufferSize))
-        {
-            Ret = TRUE;
-        }
-    }
-    else
-    {
-        /* FIXME - check string for NULL termination! */
-        Ret = TRUE;
-    }
-
-    return Ret;
-}
-
-
-BOOL
-GetDeviceDescriptionString(IN HDEVINFO DeviceInfoSet,
-                           IN PSP_DEVINFO_DATA DeviceInfoData,
-                           OUT LPWSTR szBuffer,
-                           IN DWORD BufferSize)
-{
-    DWORD RegDataType;
-    BOOL Ret = FALSE;
-
-    if ((SetupDiGetDeviceRegistryProperty(DeviceInfoSet,
-                                          DeviceInfoData,
-                                          SPDRP_FRIENDLYNAME,
-                                          &RegDataType,
-                                          (PBYTE)szBuffer,
-                                          BufferSize * sizeof(WCHAR),
-                                          NULL) ||
-         SetupDiGetDeviceRegistryProperty(DeviceInfoSet,
-                                          DeviceInfoData,
-                                          SPDRP_DEVICEDESC,
-                                          &RegDataType,
-                                          (PBYTE)szBuffer,
-                                          BufferSize * sizeof(WCHAR),
-                                          NULL)) &&
-        RegDataType == REG_SZ)
-    {
-        /* FIXME - check string for NULL termination! */
-        Ret = TRUE;
-    }
-    else
-    {
-        szBuffer[0] = L'\0';
-        if (LoadString(hDllInstance,
-                       IDS_UNKNOWNDEVICE,
-                       szBuffer,
-                       BufferSize))
-        {
-            Ret = TRUE;
-        }
-    }
-
-    return Ret;
-}
-
-
-BOOL
-FindCurrentDriver(IN HDEVINFO DeviceInfoSet,
-                  IN PSP_DEVINFO_DATA DeviceInfoData,
-                  OUT PSP_DRVINFO_DATA DriverInfoData)
-{
-    HKEY hKey = INVALID_HANDLE_VALUE;
-    SP_DEVINSTALL_PARAMS InstallParams = {0};
-    SP_DRVINFO_DETAIL_DATA DriverInfoDetailData = {0};
-    WCHAR InfPath[MAX_PATH];
-    WCHAR InfSection[LINE_LEN];
-    DWORD dwType, dwLength;
-    DWORD i = 0;
-    LONG rc;
-    BOOL Ret = FALSE;
-
-    /* Steps to find the right driver:
-     * 1) Get the device install parameters
-     * 2) Open the driver registry key
-     * 3) Read the .inf file name
-     * 4) Update install params, by setting DI_ENUMSINGLEINF and .inf file name
-     * 5) Build class driver list
-     * 6) Read inf section and inf section extension from registry
-     * 7) Enumerate drivers
-     * 8) Find the one who is in the same section as current driver?
-     */
-
-    /* 1) Get the install params */
-    InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
-    if (!SetupDiGetDeviceInstallParams(DeviceInfoSet,
-                                       DeviceInfoData,
-                                       &InstallParams))
-    {
-        ERR("SetupDiSetDeviceInstallParams() failed with error 0x%lx\n", GetLastError());
-        goto Cleanup;
-    }
-
-#ifdef DI_FLAGSEX_INSTALLEDDRIVER
-    InstallParams.FlagsEx |= (DI_FLAGSEX_INSTALLEDDRIVER | DI_FLAGSEX_ALLOWEXCLUDEDDRVS);
-    if (SetupDiSetDeviceInstallParams(DeviceInfoSet,
-                                      DeviceInfoData,
-                                      &InstallParams))
-    {
-        if (SetupDiBuildDriverInfoList(DeviceInfoSet,
-                                       DeviceInfoData,
-                                       SPDIT_CLASSDRIVER) &&
-            SetupDiEnumDriverInfo(DeviceInfoSet,
-                                  DeviceInfoData,
-                                  SPDIT_CLASSDRIVER,
-                                  0,
-                                  DriverInfoData))
-        {
-            Ret = TRUE;
-        }
-
-        goto Cleanup;
-    }
-    InstallParams.FlagsEx &= ~(DI_FLAGSEX_INSTALLEDDRIVER | DI_FLAGSEX_ALLOWEXCLUDEDDRVS);
-#endif
-
-    /* 2) Open the driver registry key */
-    hKey = SetupDiOpenDevRegKey(DeviceInfoSet,
-                                DeviceInfoData,
-                                DICS_FLAG_GLOBAL,
-                                0,
-                                DIREG_DRV,
-                                KEY_QUERY_VALUE);
-    if (hKey == INVALID_HANDLE_VALUE)
-    {
-        ERR("SetupDiOpenDevRegKey() failed with error 0x%lx\n", GetLastError());
-        goto Cleanup;
-    }
-
-    /* 3) Read the .inf file name */
-    dwLength = (sizeof(InfPath) / sizeof(InfPath[0])) - 1;
-    rc = RegQueryValueEx(hKey,
-                         REGSTR_VAL_INFPATH,
-                         0,
-                         &dwType,
-                         (LPBYTE)InfPath,
-                         &dwLength);
-    if (rc != ERROR_SUCCESS)
-    {
-        ERR("RegQueryValueEx() failed with error 0x%lx\n", GetLastError());
-        SetLastError(rc);
-        goto Cleanup;
-    }
-    else if (dwType != REG_SZ)
-    {
-        ERR("Expected registry type REG_SZ (%lu), got %lu\n", REG_SZ, dwType);
-        SetLastError(ERROR_GEN_FAILURE);
-        goto Cleanup;
-    }
-    InfPath[(dwLength / sizeof(WCHAR)) - 1] = L'\0';
-
-    /* 4) Update install params, by setting DI_ENUMSINGLEINF and .inf file name */
-    InstallParams.Flags |= DI_ENUMSINGLEINF;
-    InstallParams.FlagsEx |= DI_FLAGSEX_ALLOWEXCLUDEDDRVS;
-    wcscpy(InstallParams.DriverPath, InfPath);
-    if (!SetupDiSetDeviceInstallParams(DeviceInfoSet,
-                                       DeviceInfoData,
-                                       &InstallParams))
-    {
-        ERR("SetupDiSetDeviceInstallParams() failed with error 0x%lx\n", GetLastError());
-        goto Cleanup;
-    }
-
-    /* 5) Build class driver list */
-    if (!SetupDiBuildDriverInfoList(DeviceInfoSet,
-                                    DeviceInfoData,
-                                    SPDIT_CLASSDRIVER))
-    {
-        ERR("SetupDiBuildDriverInfoList() failed with error 0x%lx\n", GetLastError());
-        goto Cleanup;
-    }
-
-    /* 6) Read inf section and from registry */
-    dwLength = (sizeof(InfSection) / sizeof(InfSection[0])) - 1;
-    rc = RegQueryValueEx(hKey,
-                         REGSTR_VAL_INFSECTION,
-                         0,
-                         &dwType,
-                         (LPBYTE)InfSection,
-                         &dwLength);
-    if (rc != ERROR_SUCCESS)
-    {
-        ERR("RegQueryValueEx() failed with error 0x%lx\n", GetLastError());
-        SetLastError(rc);
-        goto Cleanup;
-    }
-    else if (dwType != REG_SZ)
-    {
-        ERR("Expected registry type REG_SZ (%lu), got %lu\n", REG_SZ, dwType);
-        SetLastError(ERROR_GEN_FAILURE);
-        goto Cleanup;
-    }
-    InfPath[(dwLength / sizeof(WCHAR)) - 1] = L'\0';
-
-    /* 7) Enumerate drivers */
-    DriverInfoData->cbSize = sizeof(SP_DRVINFO_DATA);
-    DriverInfoDetailData.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA);
-    while (SetupDiEnumDriverInfo(DeviceInfoSet,
-                                 DeviceInfoData,
-                                 SPDIT_CLASSDRIVER,
-                                 i,
-                                 DriverInfoData))
-    {
-        /* 8) Find the one who is in the same section as current driver */
-        if (!SetupDiGetDriverInfoDetail(DeviceInfoSet,
-                                        DeviceInfoData,
-                                        DriverInfoData,
-                                        &DriverInfoDetailData,
-                                        DriverInfoDetailData.cbSize,
-                                        NULL) &&
-            GetLastError() != ERROR_INSUFFICIENT_BUFFER)
-        {
-            ERR("SetupDiGetDriverInfoDetail() failed with error 0x%lx\n", GetLastError());
-            goto Cleanup;
-        }
-        if (!wcsicmp(DriverInfoDetailData.SectionName,
-                     InfSection) != 0)
-        {
-            /* We have found the right driver */
-            Ret = TRUE;
-            goto Cleanup;
-        }
-
-        i++;
-    }
-    if (GetLastError() != ERROR_NO_MORE_ITEMS)
-    {
-        ERR("SetupDiEnumDriverInfo() failed with error 0x%lx\n", GetLastError());
-        goto Cleanup;
-    }
-
-    SetLastError(ERROR_NO_DRIVER_SELECTED);
-
-Cleanup:
-    if (hKey != INVALID_HANDLE_VALUE)
-        RegCloseKey(hKey);
-    return Ret;
-}
-
-
-HINSTANCE
-LoadAndInitComctl32(VOID)
-{
-    typedef VOID (WINAPI *PINITCOMMONCONTROLS)(VOID);
-    PINITCOMMONCONTROLS pInitCommonControls;
-    HINSTANCE hComCtl32;
-
-    hComCtl32 = LoadLibrary(L"comctl32.dll");
-    if (hComCtl32 != NULL)
-    {
-        /* initialize the common controls */
-        pInitCommonControls = (PINITCOMMONCONTROLS)GetProcAddress(hComCtl32,
-                                                                  "InitCommonControls");
-        if (pInitCommonControls == NULL)
-        {
-            FreeLibrary(hComCtl32);
-            return NULL;
-        }
-
-        pInitCommonControls();
-    }
-
-    return hComCtl32;
-}
-
-
-BOOL
-WINAPI
-DllMain(IN HINSTANCE hinstDLL,
-        IN DWORD dwReason,
-        IN LPVOID lpvReserved)
-{
-    switch (dwReason)
-    {
-        case DLL_PROCESS_ATTACH:
-            DisableThreadLibraryCalls(hinstDLL);
-            hDllInstance = hinstDLL;
-            break;
-    }
-
-    return TRUE;
-}
diff --git a/dll/win32/devmgr/resources/devmgr.ico b/dll/win32/devmgr/resources/devmgr.ico
deleted file mode 100644 (file)
index beb28a6..0000000
Binary files a/dll/win32/devmgr/resources/devmgr.ico and /dev/null differ
diff --git a/dll/win32/devmgr/stubs.c b/dll/win32/devmgr/stubs.c
deleted file mode 100644 (file)
index 7594f85..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- *
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS devmgr.dll
- * FILE:            lib/devmgr/stubs.c
- * PURPOSE:         devmgr.dll stubs
- * PROGRAMMER:      Thomas Weidenmueller (w3seek@users.sourceforge.net)
- * NOTES:           If you implement a function, remove it from this file
- *
- *                  Some helpful resources:
- *                    http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;815320
- *                    http://www.jsiinc.com/SUBO/tip7400/rh7482.htm
- *                    http://www.jsiinc.com/SUBM/tip6400/rh6490.htm
- *
- * UPDATE HISTORY:
- *      04-04-2004  Created
- */
-
-#include "precomp.h"
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceManager_ExecuteA
- *
- * DESCRIPTION
- *   Starts the Device Manager
- *
- * ARGUMENTS
- *   hWndParent:   Handle to the parent window
- *   hInst:        Handle to the application instance
- *   lpMachineName: Machine Name, NULL is the local machine
- *   nCmdShow:      Specifies how the window should be shown
- *
- * RETURN VALUE
- *   TRUE:  if no errors occured
- *   FALSE: if the device manager could not be executed
- *
- * REVISIONS
- *
- * NOTE
- *   - Win runs the device manager in a separate process, so hWndParent is somehow
- *     obsolete.
- *
- * @unimplemented
- */
-BOOL
-WINAPI
-DeviceManager_ExecuteA(HWND hWndParent,
-                       HINSTANCE hInst,
-                       LPCSTR lpMachineName,
-                       int nCmdShow)
-{
-    UNIMPLEMENTED;
-    return FALSE;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceManager_ExecuteW
- *
- * DESCRIPTION
- *   Starts the Device Manager
- *
- * ARGUMENTS
- *   hWndParent:   Handle to the parent window
- *   hInst:        Handle to the application instance
- *   lpMachineName: Machine Name, NULL is the local machine
- *   nCmdShow:      Specifies how the window should be shown
- *
- * RETURN VALUE
- *   TRUE:  if no errors occured
- *   FALSE: if the device manager could not be executed
- *
- * REVISIONS
- *
- * NOTE
- *   - Win runs the device manager in a separate process, so hWndParent is somehow
- *     obsolete.
- *
- * @unimplemented
- */
-BOOL
-WINAPI
-DeviceManager_ExecuteW(HWND hWndParent,
-                       HINSTANCE hInst,
-                       LPCWSTR lpMachineName,
-                       int nCmdShow)
-{
-    UNIMPLEMENTED;
-    return FALSE;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceProblemWizard_RunDLLA
- *
- * DESCRIPTION
- *   Calls the device problem wizard
- *
- * ARGUMENTS
- *   hWndParent:  Handle to the parent window
- *   hInst:       Handle to the application instance
- *   lpDeviceCmd: A command that includes the DeviceID of the properties to be shown,
- *                also see NOTEs
- *   nCmdShow:    Specifies how the window should be shown
- *
- * RETURN VALUE
- *
- * REVISIONS
- *
- * NOTE
- *   - Win XP exports this function as DeviceProblenWizard_RunDLLA, apparently it's
- *     a typo so we additionally export an alias function
- *   - lpDeviceCmd is a string in the form of "/MachineName MACHINE /DeviceID DEVICEPATH"
- *     (/MachineName is optional). This function only parses this string and eventually
- *     calls DeviceProperties().
- *
- * @unimplemented
- */
-VOID
-WINAPI
-DeviceProblemWizard_RunDLLA(HWND hWndParent,
-                            HINSTANCE hInst,
-                            LPCSTR lpDeviceCmd,
-                            int nCmdShow)
-{
-    UNIMPLEMENTED;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceProblemWizard_RunDLLW
- *
- * DESCRIPTION
- *   Calls the device problem wizard
- *
- * ARGUMENTS
- *   hWndParent:  Handle to the parent window
- *   hInst:       Handle to the application instance
- *   lpDeviceCmd: A command that includes the DeviceID of the properties to be shown,
- *                also see NOTEs
- *   nCmdShow:    Specifies how the window should be shown
- *
- * RETURN VALUE
- *
- * REVISIONS
- *
- * NOTE
- *   - Win XP exports this function as DeviceProblenWizard_RunDLLA, apparently it's
- *     a typo so we additionally export an alias function
- *   - lpDeviceCmd is a string in the form of "/MachineName MACHINE /DeviceID DEVICEPATH"
- *     (/MachineName is optional). This function only parses this string and eventually
- *     calls DeviceProperties().
- *
- * @unimplemented
- */
-VOID
-WINAPI
-DeviceProblemWizard_RunDLLW(HWND hWndParent,
-                            HINSTANCE hInst,
-                            LPCWSTR lpDeviceCmd,
-                            int nCmdShow)
-{
-    UNIMPLEMENTED;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceManagerPrintA
- *
- * DESCRIPTION
- *   Calls the device problem wizard
- *
- * ARGUMENTS
- *   lpMachineName:  Machine Name, NULL is the local machine
- *   lpPrinter:      Filename of the printer where it should be printed on
- *   nPrintMode:     Specifies what kind of information is to be printed
- *                     DEV_PRINT_ABSTRACT: Prints an abstract of system information, the parameters
- *                                         uNumberOfGuids, Guids are ignored
- *                     DEV_PRINT_SELECTED: Prints information about the devices listed in Guids
- *                     DEV_PRINT_ALL:      Prints an abstract of system information and all
- *                                         system devices
- *   uNumberOfGuids: Numbers of guids in the Guids array, this parameter is ignored unless
- *                   nPrintMode is DEV_PRINT_SELECTED
- *   lpGuids:        Array of device guids, this parameter is ignored unless
- *                   nPrintMode is DEV_PRINT_SELECTED
- *
- * RETURN VALUE
- *   TRUE:  if no errors occured
- *   FALSE: if errors occured
- *
- * REVISIONS
- *
- * NOTE
- *
- * @unimplemented
- */
-BOOL
-WINAPI
-DeviceManagerPrintA(LPCSTR lpMachineName,
-                    LPCSTR lpPrinter,
-                    int nPrintMode,
-                    UINT uNumberOfGuids,
-                    LPGUID lpGuids)
-{
-    UNIMPLEMENTED;
-    return FALSE;
-}
-
-
-/***************************************************************************
- * NAME                                                         EXPORTED
- *      DeviceManagerPrintW
- *
- * DESCRIPTION
- *   Calls the device problem wizard
- *
- * ARGUMENTS
- *   lpMachineName:  Machine Name, NULL is the local machine
- *   lpPrinter:      Filename of the printer where it should be printed on
- *   nPrintMode:     Specifies what kind of information is to be printed
- *                     DEV_PRINT_ABSTRACT: Prints an abstract of system information, the parameters
- *                                         uNumberOfGuids, Guids are ignored
- *                     DEV_PRINT_SELECTED: Prints information about the devices listed in Guids
- *                     DEV_PRINT_ALL:      Prints an abstract of system information and all
- *                                         system devices
- *   uNumberOfGuids: Numbers of guids in the Guids array, this parameter is ignored unless
- *                   nPrintMode is DEV_PRINT_SELECTED
- *   lpGuids:        Array of device guids, this parameter is ignored unless
- *                   nPrintMode is DEV_PRINT_SELECTED
- *
- * RETURN VALUE
- *   TRUE:  if no errors occured
- *   FALSE: if errors occured
- *
- * REVISIONS
- *
- * NOTE
- *
- * @unimplemented
- */
-BOOL
-WINAPI
-DeviceManagerPrintW(LPCWSTR lpMachineName,
-                    LPCWSTR lpPrinter,
-                    int nPrintMode,
-                    UINT uNumberOfGuids,
-                    LPGUID lpGuids)
-{
-    UNIMPLEMENTED;
-    return FALSE;
-}
diff --git a/dll/win32/ws2_32/include/catalog.h b/dll/win32/ws2_32/include/catalog.h
deleted file mode 100644 (file)
index 1b8f765..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/include/catalog.h
- * PURPOSE:     Service Provider Catalog definitions
- */
-
-#ifndef __CATALOG_H
-#define __CATALOG_H
-
-typedef struct _CATALOG_ENTRY
-{
-    LIST_ENTRY ListEntry;
-    ULONG ReferenceCount;
-    CRITICAL_SECTION Lock;
-    UNICODE_STRING LibraryName;
-    HMODULE hModule;
-    WSAPROTOCOL_INFOW ProtocolInfo;
-    PWINSOCK_MAPPING Mapping;
-    LPWSPSTARTUP WSPStartup;
-    WSPDATA WSPData;
-    WSPPROC_TABLE ProcTable;
-} CATALOG_ENTRY, *PCATALOG_ENTRY;
-
-extern LIST_ENTRY Catalog;
-
-
-VOID ReferenceProviderByPointer(
-    PCATALOG_ENTRY Provider);
-
-VOID DereferenceProviderByPointer(
-    PCATALOG_ENTRY Provider);
-
-PCATALOG_ENTRY CreateCatalogEntry(
-    LPWSTR LibraryName);
-
-INT DestroyCatalogEntry(
-    PCATALOG_ENTRY Provider);
-
-PCATALOG_ENTRY LocateProvider(
-    LPWSAPROTOCOL_INFOW lpProtocolInfo);
-
-PCATALOG_ENTRY LocateProviderById(
-    DWORD CatalogEntryId);
-
-INT LoadProvider(
-    PCATALOG_ENTRY Provider,
-    LPWSAPROTOCOL_INFOW lpProtocolInfo);
-
-INT UnloadProvider(
-    PCATALOG_ENTRY Provider);
-
-VOID CreateCatalog(VOID);
-
-VOID DestroyCatalog(VOID);
-
-#endif /* __CATALOG_H */
diff --git a/dll/win32/ws2_32/include/debug.h b/dll/win32/ws2_32/include/debug.h
deleted file mode 100644 (file)
index 18b5373..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/include/debug.h
- * PURPOSE:     Debugging support macros
- * DEFINES:     DBG     - Enable debug output
- *              NASSERT - Disable assertions
- */
-
-#ifndef __DEBUG_H
-#define __DEBUG_H
-
-#define NORMAL_MASK    0x000000FF
-#define SPECIAL_MASK   0xFFFFFF00
-#define MIN_TRACE      0x00000001
-#define MID_TRACE      0x00000002
-#define MAX_TRACE      0x00000003
-
-#define DEBUG_CHECK    0x00000100
-#define DEBUG_ULTRA    0xFFFFFFFF
-
-#ifdef ASSERT
-#undef ASSERT
-#endif
-
-#if DBG
-
-extern DWORD DebugTraceLevel;
-
-#define WS_DbgPrint(_t_, _x_) \
-    if ((_t_ > NORMAL_MASK) \
-        ? (DebugTraceLevel & _t_) > NORMAL_MASK \
-        : (DebugTraceLevel & NORMAL_MASK) >= _t_) { \
-        DbgPrint("(%hS:%d)(%hS) ", __FILE__, __LINE__, __FUNCTION__); \
-               DbgPrint _x_; \
-    }
-
-#ifdef NASSERT
-#define ASSERT(x)
-#else /* NASSERT */
-#define ASSERT(x) if (!(x)) { WS_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); ExitProcess(0); }
-#endif /* NASSERT */
-
-#else /* DBG */
-
-#define WS_DbgPrint(_t_, _x_)
-
-#define ASSERT_IRQL(x)
-#define ASSERT(x)
-
-#endif /* DBG */
-
-
-#define assert(x) ASSERT(x)
-#define assert_irql(x) ASSERT_IRQL(x)
-
-
-#define UNIMPLEMENTED \
-    WS_DbgPrint(MIN_TRACE, ("is unimplemented, please try again later.\n"));
-
-#define CHECKPOINT \
-    WS_DbgPrint(DEBUG_CHECK, ("\n"));
-
-#define CP CHECKPOINT
-
-#endif /* __DEBUG_H */
diff --git a/dll/win32/ws2_32/include/handle.h b/dll/win32/ws2_32/include/handle.h
deleted file mode 100644 (file)
index f4cf8a8..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/include/handle.h
- * PURPOSE:     Provider handle definitions
- */
-
-#ifndef __HANDLE_H
-#define __HANDLE_H
-
-typedef struct _PROVIDER_HANDLE
-{
-    HANDLE Handle;
-    PCATALOG_ENTRY Provider;
-} PROVIDER_HANDLE, *PPROVIDER_HANDLE;
-
-#define HANDLE_BLOCK_ENTRIES ((1024-sizeof(LIST_ENTRY))/sizeof(PROVIDER_HANDLE))
-
-typedef struct _PROVIDER_HANDLE_BLOCK
-{
-    LIST_ENTRY Entry;
-    PROVIDER_HANDLE Handles[HANDLE_BLOCK_ENTRIES];
-} PROVIDER_HANDLE_BLOCK, *PPROVIDER_HANDLE_BLOCK;
-
-extern PPROVIDER_HANDLE_BLOCK ProviderHandleTable;
-
-
-HANDLE
-CreateProviderHandle(HANDLE Handle,
-                     PCATALOG_ENTRY Provider);
-
-BOOL
-ReferenceProviderByHandle(HANDLE Handle,
-                          PCATALOG_ENTRY* Provider);
-
-BOOL
-CloseProviderHandle(HANDLE Handle);
-
-BOOL
-InitProviderHandleTable(VOID);
-
-VOID
-FreeProviderHandleTable(VOID);
-
-#endif /* __HANDLE_H */
diff --git a/dll/win32/ws2_32/include/upcall.h b/dll/win32/ws2_32/include/upcall.h
deleted file mode 100644 (file)
index 116b459..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/include/upcall.h
- * PURPOSE:     Upcall function defintions
- */
-
-#ifndef __UPCALL_H
-#define __UPCALL_H
-
-BOOL
-WSPAPI
-WPUCloseEvent(
-    IN  WSAEVENT hEvent,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WPUCloseSocketHandle(
-    IN  SOCKET s,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WPUCloseThread(
-    IN  LPWSATHREADID lpThreadId,
-    OUT LPINT lpErrno);
-
-WSAEVENT
-WSPAPI
-WPUCreateEvent(
-    OUT LPINT lpErrno);
-
-SOCKET
-WSPAPI
-WPUCreateSocketHandle(
-    IN  DWORD dwCatalogEntryId,
-    IN  DWORD_PTR dwContext,
-    OUT LPINT lpErrno);
-
-int
-WSPAPI
-WPUFDIsSet(
-    IN  SOCKET s,
-    IN  LPFD_SET set);
-
-INT
-WSPAPI
-WPUGetProviderPath(
-    IN      LPGUID lpProviderId,
-    OUT     LPWSTR lpszProviderDllPath,
-    IN OUT  LPINT lpProviderDllPathLen,
-    OUT     LPINT lpErrno);
-
-SOCKET
-WSPAPI
-WPUModifyIFSHandle(
-    IN  DWORD dwCatalogEntryId,
-    IN  SOCKET ProposedHandle,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WPUOpenCurrentThread(
-    OUT LPWSATHREADID lpThreadId,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WPUQueryBlockingCallback(
-    IN  DWORD dwCatalogEntryId,
-    OUT LPBLOCKINGCALLBACK FAR* lplpfnCallback,
-    OUT PDWORD_PTR lpdwContext,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WPUQuerySocketHandleContext(
-    IN  SOCKET s,
-    OUT PDWORD_PTR lpContext,
-    OUT LPINT lpErrno);
-
-INT
-WSPAPI
-WPUQueueApc(
-    IN  LPWSATHREADID lpThreadId,
-    IN  LPWSAUSERAPC lpfnUserApc,
-    IN  DWORD_PTR dwContext,
-    OUT LPINT lpErrno);
-
-BOOL
-WSPAPI
-WPUResetEvent(
-    IN  WSAEVENT hEvent,
-    OUT LPINT lpErrno);
-
-BOOL
-WSPAPI
-WPUSetEvent(
-    IN  WSAEVENT hEvent,
-    OUT LPINT lpErrno);
-
-#endif /* __UPCALL_H */
diff --git a/dll/win32/ws2_32/include/ws2_32.h b/dll/win32/ws2_32/include/ws2_32.h
deleted file mode 100644 (file)
index fbd894a..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/include/ws2_32.h
- * PURPOSE:     WinSock 2 DLL header
- */
-
-#ifndef __WS2_32_H
-#define __WS2_32_H
-
-#include <stdarg.h>
-
-#define WIN32_NO_STATUS
-#define _INC_WINDOWS
-#define COM_NO_WINDOWS_H
-
-#include <windef.h>
-#include <winbase.h>
-#include <winnls.h>
-#include <winuser.h>
-#include <ws2spi.h>
-#define NTOS_MODE_USER
-#include <ndk/rtlfuncs.h>
-#include <pseh/pseh2.h>
-
-#include <wsahelp.h>
-
-#undef assert
-#include <debug.h>
-#include <windns.h> // DNS_A_DATA
-
-#include "catalog.h"
-#include "handle.h"
-
-#define EXPORT WINAPI
-
-extern HINSTANCE g_hInstDll;
-extern HANDLE GlobalHeap;
-extern BOOL WsaInitialized;    /* TRUE if WSAStartup() has been successfully called */
-extern WSPUPCALLTABLE UpcallTable;
-
-#define WS2_INTERNAL_MAX_ALIAS 16
-
-typedef struct _WINSOCK_GETSERVBYNAME_CACHE
-{
-    UINT Size;
-    SERVENT ServerEntry;
-    PCHAR Aliases[WS2_INTERNAL_MAX_ALIAS];
-    CHAR Data[1];
-} WINSOCK_GETSERVBYNAME_CACHE, *PWINSOCK_GETSERVBYNAME_CACHE;
-
-typedef struct _WINSOCK_GETSERVBYPORT_CACHE
-{
-    UINT Size;
-    SERVENT ServerEntry;
-    PCHAR Aliases[WS2_INTERNAL_MAX_ALIAS];
-    CHAR Data[1];
-} WINSOCK_GETSERVBYPORT_CACHE, *PWINSOCK_GETSERVBYPORT_CACHE;
-
-typedef struct _WINSOCK_THREAD_BLOCK
-{
-    INT LastErrorValue;     /* Error value from last function that failed */
-    CHAR Intoa[16];         /* Buffer for inet_ntoa() */
-    PWINSOCK_GETSERVBYNAME_CACHE
-    Getservbyname;          /* Buffer used by getservbyname */
-    PWINSOCK_GETSERVBYPORT_CACHE
-    Getservbyport;          /* Buffer used by getservbyname */
-    struct hostent* Hostent;
-} WINSOCK_THREAD_BLOCK, *PWINSOCK_THREAD_BLOCK;
-
-
-/* Macros */
-
-#define WSAINITIALIZED (WsaInitialized)
-
-#define WSASETINITIALIZED (WsaInitialized = TRUE)
-
-/* ws2_32 internal Functions */
-void check_hostent(struct hostent **he);
-void populate_hostent(struct hostent *he, char* name, IP4_ADDRESS addr);
-void free_hostent(struct hostent *he);
-void free_servent(struct servent* s);
-
-#ifdef LE
-
-/* DWORD network to host byte order conversion for little endian machines */
-#define DN2H(dw) \
-  ((((dw) & 0xFF000000L) >> 24) | \
-   (((dw) & 0x00FF0000L) >> 8) | \
-        (((dw) & 0x0000FF00L) << 8) | \
-        (((dw) & 0x000000FFL) << 24))
-
-/* DWORD host to network byte order conversion for little endian machines */
-#define DH2N(dw) \
-       ((((dw) & 0xFF000000L) >> 24) | \
-        (((dw) & 0x00FF0000L) >> 8) | \
-        (((dw) & 0x0000FF00L) << 8) | \
-        (((dw) & 0x000000FFL) << 24))
-
-/* WORD network to host order conversion for little endian machines */
-#define WN2H(w) \
-       ((((w) & 0xFF00) >> 8) | \
-        (((w) & 0x00FF) << 8))
-
-/* WORD host to network byte order conversion for little endian machines */
-#define WH2N(w) \
-       ((((w) & 0xFF00) >> 8) | \
-        (((w) & 0x00FF) << 8))
-
-#else /* LE */
-
-/* DWORD network to host byte order conversion for big endian machines */
-#define DN2H(dw) \
-    (dw)
-
-/* DWORD host to network byte order conversion big endian machines */
-#define DH2N(dw) \
-    (dw)
-
-/* WORD network to host order conversion for big endian machines */
-#define WN2H(w) \
-    (w)
-
-/* WORD host to network byte order conversion for big endian machines */
-#define WH2N(w) \
-    (w)
-
-#endif /* LE */
-
-#endif /* __WS2_32_H */
diff --git a/dll/win32/ws2_32/misc/bsd.c b/dll/win32/ws2_32/misc/bsd.c
deleted file mode 100644 (file)
index bb14c81..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/misc/bsd.c
- * PURPOSE:     Legacy BSD sockets APIs
- * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
- * REVISIONS:
- *   CSH 15/06-2001 Created
- */
-
-#include "ws2_32.h"
-
-/*
- * @implemented
- */
-ULONG
-EXPORT
-htonl(IN ULONG hostlong)
-{
-    return DH2N(hostlong);
-}
-
-
-/*
- * @implemented
- */
-USHORT
-EXPORT
-htons(IN USHORT hostshort)
-{
-    return WH2N(hostshort);
-}
-
-
-/*
- * @implemented
- */
-ULONG
-EXPORT
-ntohl(IN ULONG netlong)
-{
-    return DN2H(netlong);
-}
-
-
-/*
- * @implemented
- */
-USHORT
-EXPORT
-ntohs(IN USHORT netshort)
-{
-    return WN2H(netshort);
-}
-
-/* EOF */
diff --git a/dll/win32/ws2_32/misc/catalog.c b/dll/win32/ws2_32/misc/catalog.c
deleted file mode 100644 (file)
index 1a565bb..0000000
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/misc/catalog.c
- * PURPOSE:     Service Provider Catalog
- * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
- * REVISIONS:
- *   CSH 01/09-2000 Created
- */
-
-#include "ws2_32.h"
-
-LIST_ENTRY CatalogListHead;
-CRITICAL_SECTION CatalogLock;
-
-VOID
-ReferenceProviderByPointer(PCATALOG_ENTRY Provider)
-{
-    WS_DbgPrint(MAX_TRACE, ("Provider (0x%X).\n", Provider));
-
-    //EnterCriticalSection(&Provider->Lock);
-    Provider->ReferenceCount++;
-    //LeaveCriticalSection(&Provider->Lock);
-
-    WS_DbgPrint(MAX_TRACE, ("Leaving\n"));
-}
-
-
-VOID
-DereferenceProviderByPointer(PCATALOG_ENTRY Provider)
-{
-    WS_DbgPrint(MAX_TRACE, ("Provider (0x%X).\n", Provider));
-
-#if DBG
-    if (Provider->ReferenceCount <= 0)
-    {
-        WS_DbgPrint(MIN_TRACE, ("Provider at 0x%X has invalid reference count (%ld).\n",
-                    Provider, Provider->ReferenceCount));
-    }
-#endif
-
-    //EnterCriticalSection(&Provider->Lock);
-    Provider->ReferenceCount--;
-    //LeaveCriticalSection(&Provider->Lock);
-
-    if (Provider->ReferenceCount == 0)
-    {
-        WS_DbgPrint(MAX_TRACE, ("Provider at 0x%X has reference count 0 (unloading).\n",
-                    Provider));
-
-        DestroyCatalogEntry(Provider);
-    }
-}
-
-
-PCATALOG_ENTRY
-CreateCatalogEntry(LPWSTR LibraryName)
-{
-    PCATALOG_ENTRY Provider;
-
-    WS_DbgPrint(MAX_TRACE, ("LibraryName (%S).\n", LibraryName));
-
-    Provider = HeapAlloc(GlobalHeap, 0, sizeof(CATALOG_ENTRY));
-    if (!Provider)
-        return NULL;
-
-    ZeroMemory(Provider, sizeof(CATALOG_ENTRY));
-
-    if (!RtlCreateUnicodeString(&Provider->LibraryName, LibraryName))
-    {
-        HeapFree(GlobalHeap, 0, Provider);
-        return NULL;
-    }
-
-    Provider->ReferenceCount = 1;
-
-    InitializeCriticalSection(&Provider->Lock);
-    Provider->hModule = NULL;
-
-    Provider->Mapping = NULL;
-
-    //EnterCriticalSection(&CatalogLock);
-
-    InsertTailList(&CatalogListHead, &Provider->ListEntry);
-
-    //LeaveCriticalSection(&CatalogLock);
-
-    return Provider;
-}
-
-
-INT
-DestroyCatalogEntry(PCATALOG_ENTRY Provider)
-{
-    INT Status;
-
-    WS_DbgPrint(MAX_TRACE, ("Provider (0x%X).\n", Provider));
-
-    //EnterCriticalSection(&CatalogLock);
-    RemoveEntryList(&Provider->ListEntry);
-    //LeaveCriticalSection(&CatalogLock);
-
-    HeapFree(GlobalHeap, 0, Provider->Mapping);
-
-    if (NULL != Provider->hModule)
-    {
-        Status = UnloadProvider(Provider);
-    }
-    else
-    {
-        Status = NO_ERROR;
-    }
-
-    //DeleteCriticalSection(&Provider->Lock);
-
-    HeapFree(GlobalHeap, 0, Provider);
-
-    return Status;
-}
-
-
-PCATALOG_ENTRY
-LocateProvider(LPWSAPROTOCOL_INFOW lpProtocolInfo)
-{
-    PLIST_ENTRY CurrentEntry;
-    PCATALOG_ENTRY Provider;
-    UINT i;
-
-    WS_DbgPrint(MAX_TRACE, ("lpProtocolInfo (0x%X).\n", lpProtocolInfo));
-
-    //EnterCriticalSection(&CatalogLock);
-
-    CurrentEntry = CatalogListHead.Flink;
-    while (CurrentEntry != &CatalogListHead)
-    {
-        Provider = CONTAINING_RECORD(CurrentEntry,
-                                     CATALOG_ENTRY,
-                                     ListEntry);
-
-        for (i = 0; i < Provider->Mapping->Rows; i++)
-        {
-            if ((lpProtocolInfo->iAddressFamily == (INT) Provider->Mapping->Mapping[i].AddressFamily) &&
-                (lpProtocolInfo->iSocketType    == (INT) Provider->Mapping->Mapping[i].SocketType) &&
-                ((lpProtocolInfo->iProtocol     == (INT) Provider->Mapping->Mapping[i].Protocol) ||
-                (lpProtocolInfo->iSocketType    == SOCK_RAW)))
-            {
-                //LeaveCriticalSection(&CatalogLock);
-                lpProtocolInfo->dwCatalogEntryId = Provider->ProtocolInfo.dwCatalogEntryId;
-                WS_DbgPrint(MID_TRACE, ("Returning provider at (0x%X).\n", Provider));
-                return Provider;
-            }
-        }
-
-        CurrentEntry = CurrentEntry->Flink;
-    }
-
-    //LeaveCriticalSection(&CatalogLock);
-
-    return NULL;
-}
-
-
-PCATALOG_ENTRY
-LocateProviderById(DWORD CatalogEntryId)
-{
-    PLIST_ENTRY CurrentEntry;
-    PCATALOG_ENTRY Provider;
-
-    WS_DbgPrint(MAX_TRACE, ("CatalogEntryId (%d).\n", CatalogEntryId));
-
-    //EnterCriticalSection(&CatalogLock);
-    CurrentEntry = CatalogListHead.Flink;
-    while (CurrentEntry != &CatalogListHead)
-    {
-        Provider = CONTAINING_RECORD(CurrentEntry,
-                                     CATALOG_ENTRY,
-                                     ListEntry);
-
-        if (Provider->ProtocolInfo.dwCatalogEntryId == CatalogEntryId)
-        {
-            //LeaveCriticalSection(&CatalogLock);
-            WS_DbgPrint(MID_TRACE, ("Returning provider at (0x%X)  Name (%wZ).\n",
-                        Provider, &Provider->LibraryName));
-            return Provider;
-        }
-
-        CurrentEntry = CurrentEntry->Flink;
-    }
-    //LeaveCriticalSection(&CatalogLock);
-
-    WS_DbgPrint(MID_TRACE, ("Provider was not found.\n"));
-
-    return NULL;
-}
-
-
-INT
-LoadProvider(PCATALOG_ENTRY Provider,
-             LPWSAPROTOCOL_INFOW lpProtocolInfo)
-{
-    INT Status;
-
-    WS_DbgPrint(MID_TRACE, ("Loading provider at (0x%X)  Name (%wZ).\n",
-                Provider, &Provider->LibraryName));
-
-    if (NULL == Provider->hModule)
-    {
-        /* DLL is not loaded so load it now
-         * UNICODE_STRING objects are not null-terminated, but LoadLibraryW
-         * expects a null-terminated string
-         */
-        Provider->LibraryName.Buffer[Provider->LibraryName.Length / sizeof(WCHAR)] = L'\0';
-        Provider->hModule = LoadLibraryW(Provider->LibraryName.Buffer);
-        if (NULL != Provider->hModule)
-        {
-            Provider->WSPStartup = (LPWSPSTARTUP)GetProcAddress(Provider->hModule,
-                                                                "WSPStartup");
-            if (Provider->WSPStartup)
-            {
-                WS_DbgPrint(MAX_TRACE, ("Calling WSPStartup at (0x%X).\n",
-                            Provider->WSPStartup));
-                Status = Provider->WSPStartup(MAKEWORD(2, 2),
-                                              &Provider->WSPData,
-                                              lpProtocolInfo,
-                                              UpcallTable,
-                                              &Provider->ProcTable);
-
-                /* FIXME: Validate the procedure table */
-            }
-            else
-                Status = ERROR_BAD_PROVIDER;
-        }
-        else
-            Status = ERROR_DLL_NOT_FOUND;
-    }
-    else
-        Status = NO_ERROR;
-
-    WS_DbgPrint(MID_TRACE, ("Status (%d).\n", Status));
-
-    return Status;
-}
-
-
-INT
-UnloadProvider(PCATALOG_ENTRY Provider)
-{
-    INT Status = NO_ERROR;
-
-    WS_DbgPrint(MAX_TRACE, ("Unloading provider at (0x%X)\n", Provider));
-
-    if (NULL != Provider->hModule)
-    {
-        WS_DbgPrint(MAX_TRACE, ("Calling WSPCleanup at (0x%X).\n",
-        Provider->ProcTable.lpWSPCleanup));
-        Provider->ProcTable.lpWSPCleanup(&Status);
-
-        WS_DbgPrint(MAX_TRACE, ("Calling FreeLibrary(0x%X).\n", Provider->hModule));
-        if (!FreeLibrary(Provider->hModule))
-        {
-            WS_DbgPrint(MIN_TRACE, ("Could not free library at (0x%X).\n", Provider->hModule));
-            Status = GetLastError();
-        }
-
-        Provider->hModule = NULL;
-    }
-
-    WS_DbgPrint(MAX_TRACE, ("Status (%d).\n", Status));
-
-    return Status;
-}
-
-
-VOID
-CreateCatalog(VOID)
-{
-    PCATALOG_ENTRY Provider;
-
-    InitializeCriticalSection(&CatalogLock);
-
-    InitializeListHead(&CatalogListHead);
-
-    /* FIXME: Read service provider catalog from registry
-
-    Catalog info is saved somewhere under
-    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2
-    */
-
-#if 1
-    Provider = CreateCatalogEntry(L"msafd.dll");
-    if (!Provider)
-    {
-        WS_DbgPrint(MIN_TRACE, ("Could not create catalog entry.\n"));
-        return;
-    }
-
-    /* Assume one Service Provider with id 1 */
-    Provider->ProtocolInfo.dwCatalogEntryId = 1;
-
-    Provider->Mapping = HeapAlloc(GlobalHeap,
-                                  0,
-                                  6 * sizeof(WINSOCK_MAPPING) + 3 * sizeof(DWORD));
-    if (!Provider->Mapping)
-        return;
-
-    Provider->Mapping->Rows    = 6;
-    Provider->Mapping->Columns = 3;
-
-    Provider->Mapping->Mapping[0].AddressFamily = AF_INET;
-    Provider->Mapping->Mapping[0].SocketType    = SOCK_STREAM;
-    Provider->Mapping->Mapping[0].Protocol      = 0;
-
-    Provider->Mapping->Mapping[1].AddressFamily = AF_INET;
-    Provider->Mapping->Mapping[1].SocketType    = SOCK_STREAM;
-    Provider->Mapping->Mapping[1].Protocol      = IPPROTO_TCP;
-
-    Provider->Mapping->Mapping[2].AddressFamily = AF_INET;
-    Provider->Mapping->Mapping[2].SocketType    = SOCK_DGRAM;
-    Provider->Mapping->Mapping[2].Protocol      = 0;
-
-    Provider->Mapping->Mapping[3].AddressFamily = AF_INET;
-    Provider->Mapping->Mapping[3].SocketType    = SOCK_DGRAM;
-    Provider->Mapping->Mapping[3].Protocol      = IPPROTO_UDP;
-
-    Provider->Mapping->Mapping[4].AddressFamily = AF_INET;
-    Provider->Mapping->Mapping[4].SocketType    = SOCK_RAW;
-    Provider->Mapping->Mapping[4].Protocol      = IPPROTO_ICMP;
-
-    Provider->Mapping->Mapping[5].AddressFamily = AF_INET;
-    Provider->Mapping->Mapping[5].SocketType    = SOCK_RAW;
-    Provider->Mapping->Mapping[5].Protocol      = 0;
-#endif
-}
-
-
-VOID DestroyCatalog(VOID)
-{
-    PLIST_ENTRY CurrentEntry;
-    PLIST_ENTRY NextEntry;
-    PCATALOG_ENTRY Provider;
-
-    CurrentEntry = CatalogListHead.Flink;
-    while (CurrentEntry != &CatalogListHead)
-    {
-        NextEntry = CurrentEntry->Flink;
-        Provider = CONTAINING_RECORD(CurrentEntry,
-                                     CATALOG_ENTRY,
-                                     ListEntry);
-        DestroyCatalogEntry(Provider);
-        CurrentEntry = NextEntry;
-    }
-    //DeleteCriticalSection(&CatalogLock);
-}
-
-/* EOF */
diff --git a/dll/win32/ws2_32/misc/dllmain.c b/dll/win32/ws2_32/misc/dllmain.c
deleted file mode 100644 (file)
index c9ebffa..0000000
+++ /dev/null
@@ -1,913 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/misc/dllmain.c
- * PURPOSE:     DLL entry point
- * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
- * REVISIONS:
- *   CSH 01/09-2000 Created
- */
-
-#include "ws2_32.h"
-
-#if DBG
-
-/* See debug.h for debug/trace constants */
-//DWORD DebugTraceLevel = MIN_TRACE;
-//DWORD DebugTraceLevel = MAX_TRACE;
-//DWORD DebugTraceLevel = DEBUG_ULTRA;
-DWORD DebugTraceLevel = 0;
-#endif /* DBG */
-
-HINSTANCE g_hInstDll;
-HANDLE GlobalHeap;
-BOOL WsaInitialized = FALSE;    /* TRUE if WSAStartup() has been successfully called */
-WSPUPCALLTABLE UpcallTable;
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSAGetLastError(VOID)
-{
-    return GetLastError();
-}
-
-
-/*
- * @implemented
- */
-VOID
-EXPORT
-WSASetLastError(IN INT iError)
-{
-    SetLastError(iError);
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSAStartup(IN  WORD wVersionRequested,
-           OUT LPWSADATA lpWSAData)
-{
-    WORD VersionReturned = 0;
-    DWORD ErrorCode = ERROR_SUCCESS;
-
-    WS_DbgPrint(MAX_TRACE, ("WSAStartup of ws2_32.dll\n"));
-
-    if (!g_hInstDll)
-        return WSASYSNOTREADY;
-
-    if (lpWSAData == NULL)
-        return WSAEFAULT;
-
-    /* Check which version is being requested */
-    switch (LOBYTE(wVersionRequested))
-    {
-        case 0:
-
-            /* We don't support this unknown version */
-            ErrorCode = WSAVERNOTSUPPORTED;
-            break;
-
-        case 1:
-            /* We support only 1.0 and 1.1 */
-            if (HIBYTE(wVersionRequested) == 0)
-            {
-                /* Caller wants 1.0, return it */
-                VersionReturned = wVersionRequested;
-            }
-            else
-            {
-                /* The only other version we support is 1.1 */
-                VersionReturned = MAKEWORD(1, 1);
-            }
-            break;
-
-        case 2:
-            /* We support only 2.0, 2.1 and 2.2 */
-            if (HIBYTE(wVersionRequested) <= 2)
-            {
-                /* Caller wants 2.0-2.2, return it */
-                VersionReturned = MAKEWORD(2, HIBYTE(wVersionRequested));
-            }
-            else
-            {
-                /* The highest version we support is 2.2 */
-                VersionReturned = MAKEWORD(2, 2);
-            }
-            break;
-
-        default:
-
-            /* Return 2.2 */
-            VersionReturned = MAKEWORD(2, 2);
-            break;
-    }
-
-    /* Return the Version Requested, unless error */
-    lpWSAData->wVersion = VersionReturned;
-
-    lpWSAData->wHighVersion = MAKEWORD(2,2);
-    lstrcpyA(lpWSAData->szDescription, "WinSock 2.0");
-    lstrcpyA(lpWSAData->szSystemStatus, "Running");
-
-    if (LOBYTE(wVersionRequested) == 1)
-    {
-        lpWSAData->iMaxSockets = 32767;
-        lpWSAData->iMaxUdpDg = 65467;
-    } 
-    else
-    {
-        lpWSAData->iMaxSockets = 0;
-        lpWSAData->iMaxUdpDg = 0;
-    }
-    
-    /*FIXME: increment internal counter */
-
-    if (ErrorCode == ERROR_SUCCESS)
-        WSASETINITIALIZED;
-
-    return ErrorCode;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSACleanup(VOID)
-{
-    WS_DbgPrint(MAX_TRACE, ("WSACleanup of ws2_32.dll\n"));
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return WSANOTINITIALISED;
-    }
-
-    return NO_ERROR;
-}
-
-
-/*
- * @implemented
- */
-SOCKET
-EXPORT
-socket(IN  INT af,
-       IN  INT type,
-       IN  INT protocol)
-{
-    return WSASocketW(af,
-                      type,
-                      protocol,
-                      NULL,
-                      0,
-                      0);
-}
-
-
-/*
- * @implemented
- */
-SOCKET
-EXPORT
-WSASocketA(IN  INT af,
-           IN  INT type,
-           IN  INT protocol,
-           IN  LPWSAPROTOCOL_INFOA lpProtocolInfo,
-           IN  GROUP g,
-           IN  DWORD dwFlags)
-/*
- * FUNCTION: Creates a new socket
- */
-{
-    WSAPROTOCOL_INFOW ProtocolInfoW;
-    LPWSAPROTOCOL_INFOW p;
-    UNICODE_STRING StringU;
-    ANSI_STRING StringA;
-
-    WS_DbgPrint(MAX_TRACE, ("af (%d)  type (%d)  protocol (%d).\n",
-    af, type, protocol));
-
-    if (lpProtocolInfo)
-    {
-        memcpy(&ProtocolInfoW,
-               lpProtocolInfo,
-               sizeof(WSAPROTOCOL_INFOA) - sizeof(CHAR) * (WSAPROTOCOL_LEN + 1));
-        RtlInitAnsiString(&StringA, (LPSTR)lpProtocolInfo->szProtocol);
-        RtlInitUnicodeString(&StringU, (LPWSTR)&ProtocolInfoW.szProtocol);
-        RtlAnsiStringToUnicodeString(&StringU, &StringA, FALSE);
-        p = &ProtocolInfoW;
-    }
-    else
-    {
-        p = NULL;
-    }
-
-    return WSASocketW(af,
-                      type,
-                      protocol,
-                      p,
-                      g,
-                      dwFlags);
-}
-
-
-/*
- * @implemented
- */
-SOCKET
-EXPORT
-WSASocketW(IN  INT af,
-           IN  INT type,
-           IN  INT protocol,
-           IN  LPWSAPROTOCOL_INFOW lpProtocolInfo,
-           IN  GROUP g,
-           IN  DWORD dwFlags)
-/*
- * FUNCTION: Creates a new socket descriptor
- * ARGUMENTS:
- *     af             = Address family
- *     type           = Socket type
- *     protocol       = Protocol type
- *     lpProtocolInfo = Pointer to protocol information
- *     g              = Reserved
- *     dwFlags        = Socket flags
- * RETURNS:
- *     Created socket descriptor, or INVALID_SOCKET if it could not be created
- */
-{
-    INT Status;
-    SOCKET Socket;
-    PCATALOG_ENTRY Provider;
-    WSAPROTOCOL_INFOW ProtocolInfo;
-
-    WS_DbgPrint(MAX_TRACE, ("af (%d)  type (%d)  protocol (%d).\n",
-                af, type, protocol));
-
-    if (!WSAINITIALIZED)
-    {
-        WS_DbgPrint(MAX_TRACE, ("af (%d)  type (%d)  protocol (%d) = WSANOTINITIALISED.\n",
-                  af, type, protocol));
-        WSASetLastError(WSANOTINITIALISED);
-        return INVALID_SOCKET;
-    }
-
-    if (!lpProtocolInfo)
-    {
-        lpProtocolInfo = &ProtocolInfo;
-        ZeroMemory(&ProtocolInfo, sizeof(WSAPROTOCOL_INFOW));
-
-        ProtocolInfo.iAddressFamily = af;
-        ProtocolInfo.iSocketType    = type;
-        ProtocolInfo.iProtocol      = protocol;
-    }
-
-    Provider = LocateProvider(lpProtocolInfo);
-    if (!Provider)
-    {
-        WS_DbgPrint(MAX_TRACE, ("af (%d)  type (%d)  protocol (%d) = WSAEAFNOSUPPORT.\n",
-                    af, type, protocol));
-        WSASetLastError(WSAEAFNOSUPPORT);
-        return INVALID_SOCKET;
-    }
-
-    Status = LoadProvider(Provider, lpProtocolInfo);
-    if (Status != NO_ERROR)
-    {
-        WS_DbgPrint(MAX_TRACE, ("af (%d)  type (%d)  protocol (%d) = %d.\n",
-                    af, type, protocol, Status));
-        WSASetLastError(Status);
-        return INVALID_SOCKET;
-    }
-
-    WS_DbgPrint(MAX_TRACE, ("Calling WSPSocket at (0x%X).\n",
-                Provider->ProcTable.lpWSPSocket));
-
-    assert(Provider->ProcTable.lpWSPSocket);
-
-    WS_DbgPrint(MAX_TRACE,("About to call provider socket fn\n"));
-
-    Socket = Provider->ProcTable.lpWSPSocket(af,
-                                             type,
-                                             protocol,
-                                             lpProtocolInfo,
-                                             g,
-                                             dwFlags,
-                                             &Status);
-
-    WS_DbgPrint(MAX_TRACE,("Socket: %x, Status: %x\n", Socket, Status));
-
-    if (Status != NO_ERROR)
-    {
-        WSASetLastError(Status);
-        return INVALID_SOCKET;
-    }
-
-    WS_DbgPrint(MAX_TRACE,("Status: %x\n", Status));
-
-    return Socket;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-closesocket(IN  SOCKET s)
-/*
- * FUNCTION: Closes a socket descriptor
- * ARGUMENTS:
- *     s = Socket descriptor
- * RETURNS:
- *     0, or SOCKET_ERROR if an error ocurred
- */
-{
-    PCATALOG_ENTRY Provider;
-    INT Status;
-    INT Errno;
-
-    WS_DbgPrint(MAX_TRACE, ("s (0x%X).\n", s));
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    CloseProviderHandle((HANDLE)s);
-
-    WS_DbgPrint(MAX_TRACE,("DereferenceProviderByHandle\n"));
-
-    DereferenceProviderByPointer(Provider);
-
-    WS_DbgPrint(MAX_TRACE,("DereferenceProviderByHandle Done\n"));
-
-    Status = Provider->ProcTable.lpWSPCloseSocket(s, &Errno);
-
-    WS_DbgPrint(MAX_TRACE,("Provider Close Done\n"));
-
-    if (Status == SOCKET_ERROR)
-        WSASetLastError(Errno);
-
-    WS_DbgPrint(MAX_TRACE,("Returning success\n"));
-
-    return 0;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-select(IN      INT nfds,
-       IN OUT  LPFD_SET readfds,
-       IN OUT  LPFD_SET writefds,
-       IN OUT  LPFD_SET exceptfds,
-       IN      CONST struct timeval *timeout)
-/*
- * FUNCTION: Returns status of one or more sockets
- * ARGUMENTS:
- *     nfds      = Always ignored
- *     readfds   = Pointer to socket set to be checked for readability (optional)
- *     writefds  = Pointer to socket set to be checked for writability (optional)
- *     exceptfds = Pointer to socket set to be checked for errors (optional)
- *     timeout   = Pointer to a TIMEVAL structure indicating maximum wait time
- *                 (NULL means wait forever)
- * RETURNS:
- *     Number of ready socket descriptors, or SOCKET_ERROR if an error ocurred
- */
-{
-    PCATALOG_ENTRY Provider = NULL;
-    INT Count;
-    INT Errno;
-
-    WS_DbgPrint(MAX_TRACE, ("readfds (0x%X)  writefds (0x%X)  exceptfds (0x%X).\n",
-                readfds, writefds, exceptfds));
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        WS_DbgPrint(MID_TRACE,("Not initialized\n"));
-        return SOCKET_ERROR;
-    }
-
-    /* FIXME: Sockets in FD_SETs should be sorted by their provider */
-
-    /* FIXME: For now, assume only one service provider */
-    if ((readfds != NULL) && (readfds->fd_count > 0))
-    {
-        if (!ReferenceProviderByHandle((HANDLE)readfds->fd_array[0],
-                                       &Provider))
-        {
-            WSASetLastError(WSAENOTSOCK);
-            WS_DbgPrint(MID_TRACE,("No provider (read)\n"));
-            return SOCKET_ERROR;
-        }
-    }
-    else if ((writefds != NULL) && (writefds->fd_count > 0))
-    {
-        if (!ReferenceProviderByHandle((HANDLE)writefds->fd_array[0],
-                                       &Provider))
-        {
-            WSASetLastError(WSAENOTSOCK);
-            WS_DbgPrint(MID_TRACE,("No provider (write)\n"));
-            return SOCKET_ERROR;
-        }
-    }
-    else if ((exceptfds != NULL) && (exceptfds->fd_count > 0))
-    {
-        if (!ReferenceProviderByHandle((HANDLE)exceptfds->fd_array[0], &Provider))
-        {
-            WSASetLastError(WSAENOTSOCK);
-            WS_DbgPrint(MID_TRACE,("No provider (err)\n"));
-            return SOCKET_ERROR;
-        }
-#if 0 /* XXX empty select is not an error */
-    }
-    else
-    {
-        WSASetLastError(WSAEINVAL);
-        return SOCKET_ERROR;
-#endif
-    }
-
-    if ( !Provider )
-    {
-        if ( timeout )
-        {
-            WS_DbgPrint(MID_TRACE,("Select: used as timer\n"));
-            Sleep( timeout->tv_sec * 1000 + (timeout->tv_usec / 1000) );
-        }
-        return 0;
-    }
-    else if (Provider->ProcTable.lpWSPSelect)
-    {
-        WS_DbgPrint(MID_TRACE,("Calling WSPSelect:%x\n", Provider->ProcTable.lpWSPSelect));
-        Count = Provider->ProcTable.lpWSPSelect(nfds,
-                                                readfds,
-                                                writefds,
-                                                exceptfds,
-                                                (LPTIMEVAL)timeout,
-                                                &Errno);
-
-        WS_DbgPrint(MAX_TRACE, ("[%x] Select: Count %d Errno %x\n",
-                    Provider, Count, Errno));
-
-        DereferenceProviderByPointer(Provider);
-
-        if (Count == SOCKET_ERROR)
-        {
-            WSASetLastError(Errno);
-            return SOCKET_ERROR;
-        }
-    }
-    else
-    {
-        WSASetLastError(WSAEINVAL);
-        return SOCKET_ERROR;
-    }
-
-    return Count;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-bind(IN SOCKET s,
-     IN CONST struct sockaddr *name,
-     IN INT namelen)
-{
-    PCATALOG_ENTRY Provider;
-    INT Status;
-    INT Errno;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s,
-                                   &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-#if (__W32API_MAJOR_VERSION < 2 || __W32API_MINOR_VERSION < 5)
-    Status = Provider->ProcTable.lpWSPBind(s,
-                                           (CONST LPSOCKADDR)name,
-                                           namelen,
-                                           &Errno);
-#else
-    Status = Provider->ProcTable.lpWSPBind(s,
-                                           name,
-                                           namelen,
-                                           &Errno);
-#endif /* __W32API_MAJOR_VERSION < 2 || __W32API_MINOR_VERSION < 5 */
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Status == SOCKET_ERROR)
-        WSASetLastError(Errno);
-
-  return Status;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-listen(IN SOCKET s,
-       IN INT backlog)
-{
-    PCATALOG_ENTRY Provider;
-    INT Status;
-    INT Errno;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s,
-                                   &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    Status = Provider->ProcTable.lpWSPListen(s,
-                                             backlog,
-                                             &Errno);
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Status == SOCKET_ERROR)
-        WSASetLastError(Errno);
-
-    return Status;
-}
-
-
-/*
- * @implemented
- */
-SOCKET
-EXPORT
-accept(IN  SOCKET s,
-       OUT LPSOCKADDR addr,
-       OUT INT FAR* addrlen)
-{
-  return WSAAccept(s,
-                   addr,
-                   addrlen,
-                   NULL,
-                   0);
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-ioctlsocket(IN     SOCKET s,
-            IN     LONG cmd,
-            IN OUT ULONG FAR* argp)
-{
-       ULONG tmp;
-       
-    return WSAIoctl(s,
-                    cmd,
-                    argp,
-                    sizeof(ULONG),
-                    argp,
-                    sizeof(ULONG),
-                    &tmp,
-                    0,
-                    0);
-}
-
-
-/*
- * @implemented
- */
-SOCKET
-EXPORT
-WSAAccept(IN     SOCKET s,
-          OUT    LPSOCKADDR addr,
-          IN OUT LPINT addrlen,
-          IN     LPCONDITIONPROC lpfnCondition,
-          IN     DWORD_PTR dwCallbackData)
-{
-    PCATALOG_ENTRY Provider;
-    SOCKET Socket;
-    INT Errno;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    WS_DbgPrint(MAX_TRACE,("Calling provider accept\n"));
-
-    Socket = Provider->ProcTable.lpWSPAccept(s,
-                                             addr,
-                                             addrlen,
-                                             lpfnCondition,
-                                             dwCallbackData,
-                                             &Errno);
-
-    WS_DbgPrint(MAX_TRACE,("Calling provider accept -> Socket %x, Errno %x\n",
-                Socket, Errno));
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Socket == INVALID_SOCKET)
-        WSASetLastError(Errno);
-
-    if ( addr && addrlen )
-    {
-#if DBG
-        LPSOCKADDR_IN sa = (LPSOCKADDR_IN)addr;
-        WS_DbgPrint(MAX_TRACE,("Returned address: %d %s:%d (len %d)\n",
-                               sa->sin_family,
-                               inet_ntoa(sa->sin_addr),
-                               ntohs(sa->sin_port),
-                               *addrlen));
-#endif
-    }
-
-    return Socket;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-connect(IN  SOCKET s,
-        IN  CONST struct sockaddr *name,
-        IN  INT namelen)
-{
-  return WSAConnect(s,
-                    name,
-                    namelen,
-                    NULL,
-                    NULL,
-                    NULL,
-                    NULL);
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSAConnect(IN  SOCKET s,
-           IN  CONST struct sockaddr *name,
-           IN  INT namelen,
-           IN  LPWSABUF lpCallerData,
-           OUT LPWSABUF lpCalleeData,
-           IN  LPQOS lpSQOS,
-           IN  LPQOS lpGQOS)
-{
-    PCATALOG_ENTRY Provider;
-    INT Status;
-    INT Errno;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-#if (__W32API_MAJOR_VERSION < 2 || __W32API_MINOR_VERSION < 5)
-    Status = Provider->ProcTable.lpWSPConnect(s,
-                                              (CONST LPSOCKADDR)name,
-                                              namelen,
-                                              lpCallerData,
-                                              lpCalleeData,
-                                              lpSQOS,
-                                              lpGQOS,
-                                              &Errno);
-#else
-    Status = Provider->ProcTable.lpWSPConnect(s,
-                                              name,
-                                              namelen,
-                                              lpCallerData,
-                                              lpCalleeData,
-                                              lpSQOS,
-                                              lpGQOS,
-                                              &Errno);
-#endif
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Status == SOCKET_ERROR)
-        WSASetLastError(Errno);
-
-    return Status;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSAIoctl(IN  SOCKET s,
-         IN  DWORD dwIoControlCode,
-         IN  LPVOID lpvInBuffer,
-         IN  DWORD cbInBuffer,
-         OUT LPVOID lpvOutBuffer,
-         IN  DWORD cbOutBuffer,
-         OUT LPDWORD lpcbBytesReturned,
-         IN  LPWSAOVERLAPPED lpOverlapped,
-         IN  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
-{
-    PCATALOG_ENTRY Provider;
-    INT Status;
-    INT Errno;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    Status = Provider->ProcTable.lpWSPIoctl(s,
-                                            dwIoControlCode,
-                                            lpvInBuffer,
-                                            cbInBuffer,
-                                            lpvOutBuffer,
-                                            cbOutBuffer,
-                                            lpcbBytesReturned,
-                                            lpOverlapped,
-                                            lpCompletionRoutine,
-                                            NULL /* lpThreadId */,
-                                            &Errno);
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Status == SOCKET_ERROR)
-        WSASetLastError(Errno);
-
-    return Status;
-}
-
-/*
- * @implemented
- */
-INT
-EXPORT
-__WSAFDIsSet(SOCKET s, LPFD_SET set)
-{
-    unsigned int i;
-
-    for ( i = 0; i < set->fd_count; i++ )
-    if ( set->fd_array[i] == s ) return TRUE;
-
-    return FALSE;
-}
-
-void free_winsock_thread_block(PWINSOCK_THREAD_BLOCK p)
-{
-    if (p)
-    {
-        if (p->Hostent) { free_hostent(p->Hostent); p->Hostent = 0; }
-        if (p->Getservbyname){}
-        if (p->Getservbyport) {}
-    }
-}
-
-BOOL
-WINAPI
-DllMain(HANDLE hInstDll,
-        ULONG dwReason,
-        LPVOID lpReserved)
-{
-    PWINSOCK_THREAD_BLOCK p;
-
-    WS_DbgPrint(MAX_TRACE, ("DllMain of ws2_32.dll.\n"));
-
-    switch (dwReason)
-    {
-        case DLL_PROCESS_ATTACH:
-        {
-            GlobalHeap = GetProcessHeap();
-
-            g_hInstDll = hInstDll;
-
-            CreateCatalog();
-
-            InitProviderHandleTable();
-
-            UpcallTable.lpWPUCloseEvent         = WPUCloseEvent;
-            UpcallTable.lpWPUCloseSocketHandle  = WPUCloseSocketHandle;
-            UpcallTable.lpWPUCreateEvent        = WPUCreateEvent;
-            UpcallTable.lpWPUCreateSocketHandle = WPUCreateSocketHandle;
-            UpcallTable.lpWPUFDIsSet            = WPUFDIsSet;
-            UpcallTable.lpWPUGetProviderPath    = WPUGetProviderPath;
-            UpcallTable.lpWPUModifyIFSHandle    = WPUModifyIFSHandle;
-            UpcallTable.lpWPUPostMessage        = PostMessageW;
-            UpcallTable.lpWPUQueryBlockingCallback    = WPUQueryBlockingCallback;
-            UpcallTable.lpWPUQuerySocketHandleContext = WPUQuerySocketHandleContext;
-            UpcallTable.lpWPUQueueApc           = WPUQueueApc;
-            UpcallTable.lpWPUResetEvent         = WPUResetEvent;
-            UpcallTable.lpWPUSetEvent           = WPUSetEvent;
-            UpcallTable.lpWPUOpenCurrentThread  = WPUOpenCurrentThread;
-            UpcallTable.lpWPUCloseThread        = WPUCloseThread;
-
-            /* Fall through to thread attachment handler */
-        }
-        case DLL_THREAD_ATTACH:
-        {
-            p = HeapAlloc(GlobalHeap, 0, sizeof(WINSOCK_THREAD_BLOCK));
-
-            WS_DbgPrint(MAX_TRACE, ("Thread block at 0x%X.\n", p));
-
-            if (!p) {
-              return FALSE;
-            }
-
-            p->Hostent = NULL;
-            p->LastErrorValue = NO_ERROR;
-            p->Getservbyname  = NULL;
-            p->Getservbyport  = NULL;
-
-            NtCurrentTeb()->WinSockData = p;
-        }
-        break;
-
-        case DLL_PROCESS_DETACH:
-        {
-            if (!lpReserved)
-            {
-                FreeProviderHandleTable();
-                DestroyCatalog();
-            }
-        }
-        break;
-
-        case DLL_THREAD_DETACH:
-        {
-            p = NtCurrentTeb()->WinSockData;
-
-            if (p)
-              HeapFree(GlobalHeap, 0, p);
-        }
-        break;
-    }
-
-    WS_DbgPrint(MAX_TRACE, ("DllMain of ws2_32.dll. Leaving.\n"));
-
-    return TRUE;
-}
-
-/* EOF */
diff --git a/dll/win32/ws2_32/misc/event.c b/dll/win32/ws2_32/misc/event.c
deleted file mode 100644 (file)
index ff23a80..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/misc/event.c
- * PURPOSE:     Event handling
- * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
- * REVISIONS:
- *   CSH 01/09-2000 Created
- */
-
-#include "ws2_32.h"
-
-/*
- * @implemented
- */
-BOOL
-EXPORT
-WSACloseEvent(IN WSAEVENT hEvent)
-{
-    BOOL Success;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return FALSE;
-    }
-
-    Success = CloseHandle((HANDLE)hEvent);
-
-    if (!Success)
-        WSASetLastError(WSA_INVALID_HANDLE);
-
-    return Success;
-}
-
-
-/*
- * @implemented
- */
-WSAEVENT
-EXPORT
-WSACreateEvent(VOID)
-{
-    HANDLE Event;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return FALSE;
-    }
-
-    Event = CreateEventW(NULL, TRUE, FALSE, NULL);
-
-    if (Event == INVALID_HANDLE_VALUE)
-        WSASetLastError(WSA_INVALID_HANDLE);
-
-    return (WSAEVENT)Event;
-}
-
-
-/*
- * @implemented
- */
-BOOL
-EXPORT
-WSAResetEvent(IN WSAEVENT hEvent)
-{
-    BOOL Success;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return FALSE;
-    }
-
-    Success = ResetEvent((HANDLE)hEvent);
-
-    if (!Success)
-        WSASetLastError(WSA_INVALID_HANDLE);
-
-    return Success;
-}
-
-
-/*
- * @implemented
- */
-BOOL
-EXPORT
-WSASetEvent(IN WSAEVENT hEvent)
-{
-    BOOL Success;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return FALSE;
-    }
-
-    Success = SetEvent((HANDLE)hEvent);
-
-    if (!Success)
-        WSASetLastError(WSA_INVALID_HANDLE);
-
-    return Success;
-}
-
-
-/*
- * @implemented
- */
-DWORD
-EXPORT
-WSAWaitForMultipleEvents(IN  DWORD cEvents,
-                         IN  CONST WSAEVENT FAR* lphEvents,
-                         IN  BOOL fWaitAll,
-                         IN  DWORD dwTimeout,
-                         IN  BOOL fAlertable)
-{
-    DWORD Status;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return FALSE;
-    }
-
-    Status = WaitForMultipleObjectsEx(cEvents,
-                                      lphEvents,
-                                      fWaitAll,
-                                      dwTimeout,
-                                      fAlertable);
-    if (Status == WAIT_FAILED)
-    {
-        Status = GetLastError();
-
-        if (Status == ERROR_NOT_ENOUGH_MEMORY)
-            WSASetLastError(WSA_NOT_ENOUGH_MEMORY);
-        else if (Status == ERROR_INVALID_HANDLE)
-            WSASetLastError(WSA_INVALID_HANDLE);
-        else
-            WSASetLastError(WSA_INVALID_PARAMETER);
-
-        return WSA_WAIT_FAILED;
-    }
-
-    return Status;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSAEnumNetworkEvents(IN  SOCKET s,
-                     IN  WSAEVENT hEventObject,
-                     OUT LPWSANETWORKEVENTS lpNetworkEvents)
-{
-    PCATALOG_ENTRY Provider;
-    INT Status;
-    INT Errno;
-
-    WS_DbgPrint(MID_TRACE,("Called (Socket %x, hEventObject %x, "
-                "lpNetworkEvents %x)\n",
-                s,
-                hEventObject,
-                lpNetworkEvents));
-
-    if (!lpNetworkEvents)
-    {
-        WSASetLastError(WSAEINVAL);
-        return SOCKET_ERROR;
-    }
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s,
-                                   &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    Status = Provider->ProcTable.lpWSPEnumNetworkEvents(s,
-                                                        hEventObject,
-                                                        lpNetworkEvents,
-                                                        &Errno);
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Status == SOCKET_ERROR)
-        WSASetLastError(Errno);
-
-    WS_DbgPrint(MID_TRACE,("Leaving %x\n", Status));
-
-    return Status;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSAEventSelect(IN  SOCKET s,
-               IN  WSAEVENT hEventObject,
-               IN  LONG lNetworkEvents)
-{
-    PCATALOG_ENTRY Provider;
-    INT Status;
-    INT Errno;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    Status = Provider->ProcTable.lpWSPEventSelect(s,
-                                                  hEventObject,
-                                                  lNetworkEvents,
-                                                  &Errno);
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Status == SOCKET_ERROR)
-        WSASetLastError(Errno);
-
-    return Status;
-}
-
-/* EOF */
diff --git a/dll/win32/ws2_32/misc/handle.c b/dll/win32/ws2_32/misc/handle.c
deleted file mode 100644 (file)
index 01e39ec..0000000
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/misc/handle.c
- * PURPOSE:     Provider handle management
- * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
- * REVISIONS:
- *   CSH 01/09-2000 Created
- */
-
-#include "ws2_32.h"
-
-PPROVIDER_HANDLE_BLOCK ProviderHandleTable;
-CRITICAL_SECTION ProviderHandleTableLock;
-
-PPROVIDER_HANDLE
-GetProviderByHandle(PPROVIDER_HANDLE_BLOCK HandleTable,
-                    HANDLE Handle)
-/*
- * FUNCTION: Get the data structure for a handle
- * ARGUMENTS:
- *     HandleTable = Pointer to handle table
- *     Handle      = Handle to get data structure for
- * RETURNS:
- *     Pointer to the data structure identified by the handle on success,
- *     NULL on failure
- */
-{
-    PPROVIDER_HANDLE_BLOCK Current;
-    PLIST_ENTRY CurrentEntry;
-    ULONG i;
-
-    WS_DbgPrint(MAX_TRACE, ("HandleTable (0x%X)  Handle (0x%X).\n", HandleTable, Handle));
-
-    CurrentEntry = HandleTable->Entry.Flink;
-
-    while (CurrentEntry != &HandleTable->Entry)
-    {
-        Current = CONTAINING_RECORD(CurrentEntry, PROVIDER_HANDLE_BLOCK, Entry);
-
-        for (i = 0; i < HANDLE_BLOCK_ENTRIES; i++)
-        {
-            if ((Current->Handles[i].Provider != NULL) &&
-                (Current->Handles[i].Handle == Handle))
-            {
-                return &Current->Handles[i];
-            }
-        }
-        CurrentEntry = CurrentEntry->Flink;
-    }
-
-    return NULL;
-}
-
-
-VOID
-CloseAllHandles(PPROVIDER_HANDLE_BLOCK HandleTable)
-{
-    PPROVIDER_HANDLE_BLOCK Current;
-    PLIST_ENTRY CurrentEntry;
-    PCATALOG_ENTRY Provider;
-    ULONG i;
-
-    WS_DbgPrint(MAX_TRACE, ("HandleTable (0x%X).\n", HandleTable));
-
-    CurrentEntry = HandleTable->Entry.Flink;
-
-    while (CurrentEntry != &HandleTable->Entry)
-    {
-        Current = CONTAINING_RECORD(CurrentEntry, PROVIDER_HANDLE_BLOCK, Entry);
-
-        for (i = 0; i < HANDLE_BLOCK_ENTRIES; i++)
-        {
-            Provider = Current->Handles[i].Provider;
-            if (Provider != NULL)
-            {
-                DereferenceProviderByPointer(Provider);
-                Current->Handles[i].Handle   = (HANDLE)0;
-                Current->Handles[i].Provider = NULL;
-            }
-        }
-        CurrentEntry = CurrentEntry->Flink;
-    }
-}
-
-
-VOID
-DeleteHandleTable(PPROVIDER_HANDLE_BLOCK HandleTable)
-{
-    PPROVIDER_HANDLE_BLOCK Current;
-    PLIST_ENTRY CurrentEntry;
-
-    CloseAllHandles(HandleTable);
-
-    CurrentEntry = RemoveHeadList(&HandleTable->Entry);
-
-    while (CurrentEntry != &HandleTable->Entry)
-    {
-        Current = CONTAINING_RECORD(CurrentEntry,
-                                    PROVIDER_HANDLE_BLOCK,
-                                    Entry);
-
-        HeapFree(GlobalHeap, 0, Current);
-
-        CurrentEntry = RemoveHeadList(&HandleTable->Entry);
-    }
-}
-
-
-PCATALOG_ENTRY
-DeleteProviderHandle(PPROVIDER_HANDLE_BLOCK HandleTable,
-                     HANDLE Handle)
-{
-    PPROVIDER_HANDLE Entry;
-    PCATALOG_ENTRY Provider;
-
-    WS_DbgPrint(MAX_TRACE, ("HandleTable (0x%X)  Handle (0x%X).\n", HandleTable, Handle));
-
-    Entry = GetProviderByHandle(HandleTable, Handle);
-    if (!Entry)
-        return NULL;
-
-    Provider = Entry->Provider;
-    Entry->Handle = (HANDLE)0;
-    Entry->Provider = NULL;
-
-    return Provider;
-}
-
-
-HANDLE
-CreateProviderHandleTable(PPROVIDER_HANDLE_BLOCK HandleTable,
-                          HANDLE Handle,
-                          PCATALOG_ENTRY Provider)
-{
-    PPROVIDER_HANDLE_BLOCK NewBlock;
-    PLIST_ENTRY CurrentEntry;
-    ULONG i;
-
-    WS_DbgPrint(MAX_TRACE, ("HandleTable (0x%X)  Handle (0x%X)  Provider (0x%X).\n",
-    HandleTable, Handle, Provider));
-
-    /* Scan through the currently allocated handle blocks looking for a free slot */
-    CurrentEntry = HandleTable->Entry.Flink;
-    while (CurrentEntry != &HandleTable->Entry)
-    {
-        PPROVIDER_HANDLE_BLOCK Block = CONTAINING_RECORD(CurrentEntry,
-                                                         PROVIDER_HANDLE_BLOCK,
-                                                         Entry);
-
-        for (i = 0; i < HANDLE_BLOCK_ENTRIES; i++)
-        {
-            WS_DbgPrint(MAX_TRACE, ("Considering slot %ld containing 0x%X.\n",
-                        i,
-                        Block->Handles[i].Provider));
-            if (Block->Handles[i].Provider == NULL)
-            {
-                Block->Handles[i].Handle   = Handle;
-                Block->Handles[i].Provider = Provider;
-                return Handle;
-            }
-        }
-        CurrentEntry = CurrentEntry->Flink;
-    }
-
-    /* Add a new handle block to the end of the list */
-    NewBlock = (PPROVIDER_HANDLE_BLOCK)HeapAlloc(GlobalHeap,
-                                                 0,
-                                                 sizeof(PROVIDER_HANDLE_BLOCK));
-
-    WS_DbgPrint(MID_TRACE,("using table entry %x\n", NewBlock));
-
-    if (!NewBlock)
-        return (HANDLE)0;
-
-    ZeroMemory(NewBlock, sizeof(PROVIDER_HANDLE_BLOCK));
-    InsertTailList(&HandleTable->Entry,
-                   &NewBlock->Entry);
-
-    NewBlock->Handles[0].Handle   = Handle;
-    NewBlock->Handles[0].Provider = Provider;
-
-    return Handle;
-}
-
-
-HANDLE
-CreateProviderHandle(HANDLE Handle,
-                     PCATALOG_ENTRY Provider)
-{
-    HANDLE h;
-
-    EnterCriticalSection(&ProviderHandleTableLock);
-
-    h = CreateProviderHandleTable(ProviderHandleTable,
-                                  Handle,
-                                  Provider);
-
-    LeaveCriticalSection(&ProviderHandleTableLock);
-
-    if (h != NULL)
-        ReferenceProviderByPointer(Provider);
-
-    return h;
-}
-
-
-BOOL
-ReferenceProviderByHandle(HANDLE Handle,
-                          PCATALOG_ENTRY* Provider)
-/*
- * FUNCTION: Increments the reference count for a provider and returns a pointer to it
- * ARGUMENTS:
- *     Handle   = Handle for the provider
- *     Provider = Address of buffer to place pointer to provider
- * RETURNS:
- *     TRUE if handle was valid, FALSE if not
- */
-{
-    PPROVIDER_HANDLE ProviderHandle;
-
-    WS_DbgPrint(MID_TRACE, ("Handle (0x%X)  Provider (0x%X).\n", Handle, Provider));
-
-    EnterCriticalSection(&ProviderHandleTableLock);
-
-    ProviderHandle = GetProviderByHandle(ProviderHandleTable,
-                                         Handle);
-
-    WS_DbgPrint(MID_TRACE, ("ProviderHandle is %x\n", ProviderHandle));
-
-    LeaveCriticalSection(&ProviderHandleTableLock);
-
-    if (ProviderHandle)
-    {
-        ReferenceProviderByPointer(ProviderHandle->Provider);
-        *Provider = ProviderHandle->Provider;
-    }
-
-    return (ProviderHandle != NULL);
-}
-
-
-BOOL
-CloseProviderHandle(HANDLE Handle)
-{
-    PCATALOG_ENTRY Provider;
-
-    WS_DbgPrint(MAX_TRACE, ("Handle (0x%X).\n", Handle));
-
-    EnterCriticalSection(&ProviderHandleTableLock);
-
-    Provider = DeleteProviderHandle(ProviderHandleTable,
-                                    Handle);
-
-    LeaveCriticalSection(&ProviderHandleTableLock);
-
-    if (!Provider)
-        return FALSE;
-
-    DereferenceProviderByPointer(Provider);
-
-    return TRUE;
-}
-
-
-BOOL
-InitProviderHandleTable(VOID)
-{
-    ProviderHandleTable =
-        (PPROVIDER_HANDLE_BLOCK)HeapAlloc(GlobalHeap,
-                                          0,
-                                          sizeof(PROVIDER_HANDLE_BLOCK));
-    if (!ProviderHandleTable)
-        return FALSE;
-
-    WS_DbgPrint(MID_TRACE,("Called\n"));
-
-    ZeroMemory(ProviderHandleTable,
-               sizeof(PROVIDER_HANDLE_BLOCK));
-
-    InitializeListHead(&ProviderHandleTable->Entry);
-
-    InitializeCriticalSection(&ProviderHandleTableLock);
-
-    return TRUE;
-}
-
-
-VOID
-FreeProviderHandleTable(VOID)
-{
-    DeleteHandleTable(ProviderHandleTable);
-
-    DeleteCriticalSection(&ProviderHandleTableLock);
-}
-
-/* EOF */
diff --git a/dll/win32/ws2_32/misc/ns.c b/dll/win32/ws2_32/misc/ns.c
deleted file mode 100644 (file)
index 9383d4e..0000000
+++ /dev/null
@@ -1,1773 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/misc/ns.c
- * PURPOSE:     Namespace APIs
- * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
- * REVISIONS:
- *   CSH 01/09-2000 Created
- */
-
-#include "ws2_32.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <winnls.h>
-
-#ifndef BUFSIZ
-#define BUFSIZ 1024
-#endif/*BUFSIZ*/
-
-#ifndef MAX_HOSTNAME_LEN
-#define MAX_HOSTNAME_LEN 256
-#endif
-
-/* Name resolution APIs */
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAAddressToStringA(IN      LPSOCKADDR lpsaAddress,
-                    IN      DWORD dwAddressLength,
-                    IN      LPWSAPROTOCOL_INFOA lpProtocolInfo,
-                    OUT     LPSTR lpszAddressString,
-                    IN OUT  LPDWORD lpdwAddressStringLength)
-{
-    DWORD size;
-    CHAR buffer[54]; /* 32 digits + 7':' + '[' + '%" + 5 digits + ']:' + 5 digits + '\0' */
-    CHAR *p;
-
-    if (!lpsaAddress) return SOCKET_ERROR;
-    if (!lpszAddressString || !lpdwAddressStringLength) return SOCKET_ERROR;
-
-    switch(lpsaAddress->sa_family)
-    {
-    case AF_INET:
-        if (dwAddressLength < sizeof(SOCKADDR_IN)) return SOCKET_ERROR;
-        sprintf( buffer, "%u.%u.%u.%u:%u",
-               (unsigned int)(ntohl( ((SOCKADDR_IN *)lpsaAddress)->sin_addr.s_addr ) >> 24 & 0xff),
-               (unsigned int)(ntohl( ((SOCKADDR_IN *)lpsaAddress)->sin_addr.s_addr ) >> 16 & 0xff),
-               (unsigned int)(ntohl( ((SOCKADDR_IN *)lpsaAddress)->sin_addr.s_addr ) >> 8 & 0xff),
-               (unsigned int)(ntohl( ((SOCKADDR_IN *)lpsaAddress)->sin_addr.s_addr ) & 0xff),
-               ntohs( ((SOCKADDR_IN *)lpsaAddress)->sin_port ) );
-
-        p = strchr( buffer, ':' );
-        if (!((SOCKADDR_IN *)lpsaAddress)->sin_port) *p = 0;
-        break;
-    default:
-        WSASetLastError(WSAEINVAL);
-        return SOCKET_ERROR;
-    }
-
-    size = strlen( buffer ) + 1;
-
-    if (*lpdwAddressStringLength <  size)
-    {
-        *lpdwAddressStringLength = size;
-        WSASetLastError(WSAEFAULT);
-        return SOCKET_ERROR;
-    }
-
-    *lpdwAddressStringLength = size;
-    strcpy( lpszAddressString, buffer );
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAAddressToStringW(IN      LPSOCKADDR lpsaAddress,
-                    IN      DWORD dwAddressLength,
-                    IN      LPWSAPROTOCOL_INFOW lpProtocolInfo,
-                    OUT     LPWSTR lpszAddressString,
-                    IN OUT  LPDWORD lpdwAddressStringLength)
-{
-    INT   ret;
-    DWORD size;
-    WCHAR buffer[54]; /* 32 digits + 7':' + '[' + '%" + 5 digits + ']:' + 5 digits + '\0' */
-    CHAR bufAddr[54];
-
-    size = *lpdwAddressStringLength;
-    ret = WSAAddressToStringA(lpsaAddress, dwAddressLength, NULL, bufAddr, &size);
-
-    if (ret) return ret;
-
-    MultiByteToWideChar( CP_ACP, 0, bufAddr, size, buffer, sizeof( buffer )/sizeof(WCHAR));
-
-    if (*lpdwAddressStringLength <  size)
-    {
-        *lpdwAddressStringLength = size;
-        WSASetLastError(WSAEFAULT);
-        return SOCKET_ERROR;
-    }
-
-    *lpdwAddressStringLength = size;
-    lstrcpyW( lpszAddressString, buffer );
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAEnumNameSpaceProvidersA(IN OUT  LPDWORD lpdwBufferLength,
-                           OUT     LPWSANAMESPACE_INFOA lpnspBuffer)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAEnumNameSpaceProvidersW(IN OUT  LPDWORD lpdwBufferLength,
-                           OUT     LPWSANAMESPACE_INFOW lpnspBuffer)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAGetServiceClassInfoA(IN      LPGUID lpProviderId,
-                        IN      LPGUID lpServiceClassId,
-                        IN OUT  LPDWORD lpdwBufferLength,
-                        OUT     LPWSASERVICECLASSINFOA lpServiceClassInfo)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAGetServiceClassInfoW(IN      LPGUID lpProviderId,
-                        IN      LPGUID lpServiceClassId,
-                        IN OUT  LPDWORD lpdwBufferLength,
-                        OUT     LPWSASERVICECLASSINFOW lpServiceClassInfo)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAGetServiceClassNameByClassIdA(IN      LPGUID lpServiceClassId,
-                                 OUT     LPSTR lpszServiceClassName,
-                                 IN OUT  LPDWORD lpdwBufferLength)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAGetServiceClassNameByClassIdW(IN      LPGUID lpServiceClassId,
-                                 OUT     LPWSTR lpszServiceClassName,
-                                 IN OUT  LPDWORD lpdwBufferLength)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAInstallServiceClassA(IN  LPWSASERVICECLASSINFOA lpServiceClassInfo)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAInstallServiceClassW(IN  LPWSASERVICECLASSINFOW lpServiceClassInfo)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSALookupServiceBeginA(IN  LPWSAQUERYSETA lpqsRestrictions,
-                       IN  DWORD dwControlFlags,
-                       OUT LPHANDLE lphLookup)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSALookupServiceBeginW(IN  LPWSAQUERYSETW lpqsRestrictions,
-                       IN  DWORD dwControlFlags,
-                       OUT LPHANDLE lphLookup)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSALookupServiceEnd(IN  HANDLE hLookup)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSALookupServiceNextA(IN      HANDLE hLookup,
-                      IN      DWORD dwControlFlags,
-                      IN OUT  LPDWORD lpdwBufferLength,
-                      OUT     LPWSAQUERYSETA lpqsResults)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSALookupServiceNextW(IN      HANDLE hLookup,
-                      IN      DWORD dwControlFlags,
-                      IN OUT  LPDWORD lpdwBufferLength,
-                      OUT     LPWSAQUERYSETW lpqsResults)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSARemoveServiceClass(IN  LPGUID lpServiceClassId)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSASetServiceA(IN  LPWSAQUERYSETA lpqsRegInfo,
-               IN  WSAESETSERVICEOP essOperation,
-               IN  DWORD dwControlFlags)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSASetServiceW(IN  LPWSAQUERYSETW lpqsRegInfo,
-               IN  WSAESETSERVICEOP essOperation,
-               IN  DWORD dwControlFlags)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAStringToAddressA(IN     LPSTR AddressString,
-                    IN     INT AddressFamily,
-                    IN     LPWSAPROTOCOL_INFOA lpProtocolInfo,
-                    OUT    LPSOCKADDR lpAddress,
-                    IN OUT LPINT lpAddressLength)
-{
-    INT ret, len;
-    LPWSTR szTemp;
-    WSAPROTOCOL_INFOW ProtoInfoW;
-
-    len = MultiByteToWideChar(CP_ACP,
-                              0,
-                              AddressString,
-                              -1,
-                              NULL,
-                              0);
-
-    szTemp = HeapAlloc(GetProcessHeap(),
-                       0,
-                       len * sizeof(WCHAR));
-
-    MultiByteToWideChar(CP_ACP,
-                        0,
-                        AddressString,
-                        -1,
-                        szTemp,
-                        len);
-
-    if (lpProtocolInfo)
-    {
-        memcpy(&ProtoInfoW,
-               lpProtocolInfo,
-               FIELD_OFFSET(WSAPROTOCOL_INFOA, szProtocol));
-
-        MultiByteToWideChar(CP_ACP,
-                            0,
-                            lpProtocolInfo->szProtocol,
-                            -1,
-                            ProtoInfoW.szProtocol,
-                            WSAPROTOCOL_LEN + 1);
-    }
-
-    ret = WSAStringToAddressW(szTemp,
-                              AddressFamily,
-                              &ProtoInfoW,
-                              lpAddress,
-                              lpAddressLength);
-
-    HeapFree(GetProcessHeap(),
-             0,
-             szTemp );
-
-    WSASetLastError(ret);
-    return ret;
-}
-
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSAStringToAddressW(IN      LPWSTR AddressString,
-                    IN      INT AddressFamily,
-                    IN      LPWSAPROTOCOL_INFOW lpProtocolInfo,
-                    OUT     LPSOCKADDR lpAddress,
-                    IN OUT  LPINT lpAddressLength)
-{
-    int pos=0;
-    int res=0;
-    LONG inetaddr = 0;
-    LPWSTR *bp=NULL;
-    SOCKADDR_IN *sockaddr;
-
-    if (!lpAddressLength || !lpAddress || !AddressString)
-    {
-        WSASetLastError(WSAEINVAL);
-        return SOCKET_ERROR;
-    }
-
-    sockaddr = (SOCKADDR_IN *) lpAddress;
-
-    /* Set right adress family */
-    if (lpProtocolInfo!=NULL)
-        sockaddr->sin_family = lpProtocolInfo->iAddressFamily;
-    else
-        sockaddr->sin_family = AddressFamily;
-
-    /* Report size */
-    if (AddressFamily == AF_INET)
-    {
-        if (*lpAddressLength < (INT)sizeof(SOCKADDR_IN))
-        {
-            *lpAddressLength = sizeof(SOCKADDR_IN);
-            res = WSAEFAULT;
-        }
-        else
-        {
-            // translate ip string to ip
-
-            /* rest sockaddr.sin_addr.s_addr
-                   for we need to be sure it is zero when we come to while */
-            memset(lpAddress,0,sizeof(SOCKADDR_IN));
-
-            /* Set right adress family */
-            sockaddr->sin_family = AF_INET;
-
-            /* Get port number */
-            pos = wcscspn(AddressString,L":") + 1;
-
-            if (pos < (int)wcslen(AddressString))
-                sockaddr->sin_port = wcstol(&AddressString[pos],
-                                            bp,
-                                            10);
-
-            else
-                sockaddr->sin_port = 0;
-
-            /* Get ip number */
-            pos=0;
-            inetaddr=0;
-
-            while (pos < (int)wcslen(AddressString))
-            {
-                inetaddr = (inetaddr<<8) + ((UCHAR)wcstol(&AddressString[pos],
-                                                          bp,
-                                                          10));
-                pos += wcscspn( &AddressString[pos],L".") +1 ;
-            }
-
-            res = 0;
-            sockaddr->sin_addr.s_addr = inetaddr;
-
-        }
-    }
-
-    WSASetLastError(res);
-    if (!res) return 0;
-    return SOCKET_ERROR;
-}
-
-void check_hostent(struct hostent **he)
-{
-    struct hostent *new_he;
-
-    WS_DbgPrint(MID_TRACE,("*he: %x\n",*he));
-
-    if(!*he)
-    {
-        new_he = HeapAlloc(GlobalHeap,
-                           0,
-                           sizeof(struct hostent) + MAX_HOSTNAME_LEN + 1);
-
-        new_he->h_name = (PCHAR)(new_he + 1);
-        new_he->h_aliases = NULL;
-        new_he->h_addrtype = 0; // AF_INET
-        new_he->h_length = 0;   // sizeof(in_addr)
-        new_he->h_addr_list = HeapAlloc(GlobalHeap,
-                                        HEAP_ZERO_MEMORY,
-                                        sizeof(char *) * 2);
-
-        *he = new_he;
-    }
-}
-
-void populate_hostent(struct hostent *he, char* name, IP4_ADDRESS addr)
-{
-    ASSERT(he);
-
-    //he = HeapAlloc(GlobalHeap, 0, sizeof(struct hostent));
-    //he->h_name = HeapAlloc(GlobalHeap, 0, MAX_HOSTNAME_LEN+1);
-
-    strncpy(he->h_name,
-            name,
-            MAX_HOSTNAME_LEN);
-
-    if( !he->h_aliases ) {
-       he->h_aliases = HeapAlloc(GlobalHeap, 0, sizeof(char *));
-       he->h_aliases[0] = NULL;
-    }
-    he->h_addrtype = AF_INET;
-    he->h_length = sizeof(IN_ADDR); //sizeof(struct in_addr);
-
-    if( he->h_addr_list[0] )
-    {
-        HeapFree(GlobalHeap,
-                 0,
-                 he->h_addr_list[0]);
-    }
-
-    he->h_addr_list[0] = HeapAlloc(GlobalHeap,
-                                   0,
-                                   MAX_HOSTNAME_LEN + 1);
-
-    WS_DbgPrint(MID_TRACE,("he->h_addr_list[0] %x\n", he->h_addr_list[0]));
-
-    RtlCopyMemory(he->h_addr_list[0],
-                  &addr,
-                  sizeof(addr));
-
-    he->h_addr_list[1] = NULL;
-}
-
-void free_hostent(struct hostent *he)
-{
-    int i;
-
-    if (he)
-    {
-        if (he->h_name)
-            HeapFree(GlobalHeap, 0, he->h_name);
-        if (he->h_aliases)
-        {
-            for (i = 0; he->h_aliases[i]; i++)
-                HeapFree(GlobalHeap, 0, he->h_aliases[i]);
-            HeapFree(GlobalHeap, 0, he->h_aliases);
-        }
-        if (he->h_addr_list)
-        {
-            for (i = 0; he->h_addr_list[i]; i++)
-                HeapFree(GlobalHeap, 0, he->h_addr_list[i]);
-            HeapFree(GlobalHeap, 0, he->h_addr_list);
-        }
-        HeapFree(GlobalHeap, 0, he);
-    }
-}
-
-/* WinSock 1.1 compatible name resolution APIs */
-
-/*
- * @unimplemented
- */
-LPHOSTENT
-EXPORT
-gethostbyaddr(IN  CONST CHAR FAR* addr,
-              IN  INT len,
-              IN  INT type)
-{
-    UNIMPLEMENTED
-
-    return (LPHOSTENT)NULL;
-}
-
-/*
-  Assumes rfc 1123 - adam *
-   addr[1] = 0;
-    addr[0] = inet_addr(name);
-    strcpy( hostname, name );
-    if(addr[0] == 0xffffffff) return NULL;
-    he.h_addr_list = (void *)addr;
-    he.h_name = hostname;
-    he.h_aliases = NULL;
-    he.h_addrtype = AF_INET;
-    he.h_length = sizeof(addr);
-    return &he;
-
-<RANT>
-From the MSDN Platform SDK: Windows Sockets 2
-"The gethostbyname function cannot resolve IP address strings passed to it.
-Such a request is treated exactly as if an unknown host name were passed."
-</RANT>
-
-Defferring to the the documented behaviour, rather than the unix behaviour
-What if the hostname is in the HOSTS file? see getservbyname
-
- * @implemented
- */
-
-/* DnsQuery -- lib/dnsapi/dnsapi/query.c */
-   /* see ws2_32.h, winsock2.h*/
-    /*getnetworkparameters - iphlp api */
-/*
-REFERENCES
-
-servent -- w32api/include/winsock2.h
-PWINSOCK_THREAD_BLOCK -- ws2_32.h
-dllmain.c -- threadlocal memory allocation / deallocation
-lib/dnsapi
-
-
-*/
-      /* lib/adns/src/adns.h XXX */
-
-
-/*
-struct  hostent {
-        char    *h_name;
-        char    **h_aliases;
-        short   h_addrtype;
-        short   h_length;
-        char    **h_addr_list;
-#define h_addr h_addr_list[0]
-};
-struct  servent {
-        char    *s_name;
-        char    **s_aliases;
-        short   s_port;
-        char    *s_proto;
-};
-
-
-struct hostent defined in w32api/include/winsock2.h
-*/
-
-void free_servent(struct servent* s)
-{
-    int i;
-
-    if (s)
-    {
-        if (s->s_name)
-            HeapFree(GlobalHeap, 0, s->s_name);
-        if (s->s_aliases)
-        {
-            for (i = 0; s->s_aliases[i]; i++)
-                HeapFree(GlobalHeap, 0, s->s_aliases[i]);
-            HeapFree(GlobalHeap, 0, s->s_aliases);
-        }
-        if (s->s_proto)
-            HeapFree(GlobalHeap, 0, s->s_proto);
-        HeapFree(GlobalHeap, 0, s);
-    }
-}
-
-/* This function is far from perfect but it works enough */
-static
-LPHOSTENT
-FindEntryInHosts(IN CONST CHAR FAR* name)
-{
-    BOOL Found = FALSE;
-    HANDLE HostsFile;
-    CHAR HostsDBData[BUFSIZ] = { 0 };
-    PCHAR SystemDirectory = HostsDBData;
-    PCHAR HostsLocation = "\\drivers\\etc\\hosts";
-    PCHAR AddressStr, DnsName = NULL, AddrTerm, NameSt, NextLine, ThisLine, Comment;
-    UINT SystemDirSize = sizeof(HostsDBData) - 1, ValidData = 0;
-    DWORD ReadSize;
-    ULONG Address;
-    PWINSOCK_THREAD_BLOCK p = NtCurrentTeb()->WinSockData;
-
-    /* We assume that the parameters are valid */
-
-    if (!GetSystemDirectoryA(SystemDirectory, SystemDirSize))
-    {
-        WSASetLastError(WSANO_RECOVERY);
-        WS_DbgPrint(MIN_TRACE, ("Could not get windows system directory.\n"));
-        return NULL; /* Can't get system directory */
-    }
-
-    strncat(SystemDirectory,
-            HostsLocation,
-            SystemDirSize );
-
-    HostsFile = CreateFileA(SystemDirectory,
-                            GENERIC_READ,
-                            FILE_SHARE_READ,
-                            NULL,
-                            OPEN_EXISTING,
-                            FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
-                            NULL);
-    if (HostsFile == INVALID_HANDLE_VALUE)
-    {
-        WSASetLastError(WSANO_RECOVERY);
-        return NULL;
-    }
-
-    while(!Found &&
-          ReadFile(HostsFile,
-                   HostsDBData + ValidData,
-                   sizeof(HostsDBData) - ValidData,
-                   &ReadSize,
-                   NULL))
-    {
-        ValidData += ReadSize;
-        ReadSize = 0;
-        NextLine = ThisLine = HostsDBData;
-
-        /* Find the beginning of the next line */
-        while(NextLine < HostsDBData + ValidData &&
-              *NextLine != '\r' && *NextLine != '\n' )
-        {
-            NextLine++;
-        }
-
-        /* Zero and skip, so we can treat what we have as a string */
-        if( NextLine > HostsDBData + ValidData )
-            break;
-
-        *NextLine = 0; NextLine++;
-
-        Comment = strchr( ThisLine, '#' );
-        if( Comment ) *Comment = 0; /* Terminate at comment start */
-
-        AddressStr = ThisLine;
-        /* Find the first space separating the IP address from the DNS name */
-        AddrTerm = strchr(ThisLine, ' ');
-        if (AddrTerm)
-        {
-           /* Terminate the address string */
-           *AddrTerm = 0;
-
-           /* Find the last space before the DNS name */
-           NameSt = strrchr(ThisLine, ' ');
-
-           /* If there is only one space (the one we removed above), then just use the address terminator */
-           if (!NameSt)
-               NameSt = AddrTerm;
-
-           /* Move from the space to the first character of the DNS name */
-           NameSt++;
-
-           DnsName = NameSt;
-
-           if (!strcmp(name, DnsName))
-           {
-               Found = TRUE;
-               break;
-           }
-        }
-
-        /* Get rid of everything we read so far */
-        while( NextLine <= HostsDBData + ValidData &&
-               isspace (*NextLine))
-        {
-            NextLine++;
-        }
-
-        if (HostsDBData + ValidData - NextLine <= 0)
-            break;
-
-        WS_DbgPrint(MAX_TRACE,("About to move %d chars\n",
-                    HostsDBData + ValidData - NextLine));
-
-        memmove(HostsDBData,
-                NextLine,
-                HostsDBData + ValidData - NextLine );
-        ValidData -= NextLine - HostsDBData;
-        WS_DbgPrint(MAX_TRACE,("Valid bytes: %d\n", ValidData));
-    }
-
-    CloseHandle(HostsFile);
-
-    if (!Found)
-    {
-        WS_DbgPrint(MAX_TRACE,("Not found\n"));
-        WSASetLastError(WSANO_DATA);
-        return NULL;
-    }
-
-    if (strstr(AddressStr, ":"))
-    {
-       DbgPrint("AF_INET6 NOT SUPPORTED!\n");
-       WSASetLastError(WSAEINVAL);
-       return NULL;
-    }
-
-    Address = inet_addr(AddressStr);
-    if (Address == INADDR_NONE)
-    {
-        WSASetLastError(WSAEINVAL);
-        return NULL;
-    }
-
-    populate_hostent(p->Hostent, DnsName, Address);
-
-    return p->Hostent;
-}
-
-LPHOSTENT
-EXPORT
-gethostbyname(IN  CONST CHAR FAR* name)
-{
-    enum addr_type
-    {
-        GH_INVALID,
-        GH_IPV6,
-        GH_IPV4,
-        GH_RFC1123_DNS
-    };
-    typedef enum addr_type addr_type;
-    addr_type addr;
-    int ret = 0;
-    char* found = 0;
-    DNS_STATUS dns_status = {0};
-    /* include/WinDNS.h -- look up DNS_RECORD on MSDN */
-    PDNS_RECORD dp = 0;
-    PWINSOCK_THREAD_BLOCK p;
-    LPHOSTENT Hostent;
-
-    addr = GH_INVALID;
-
-    p = NtCurrentTeb()->WinSockData;
-
-    if (!p || !WSAINITIALIZED)
-    {
-        WSASetLastError( WSANOTINITIALISED );
-        return NULL;
-    }
-
-    check_hostent(&p->Hostent);   /*XXX alloc_hostent*/
-
-    /* Hostname NULL - behave like gethostname */
-    if(name == NULL)
-    {
-        ret = gethostname(p->Hostent->h_name, MAX_HOSTNAME_LEN);
-        if(ret)
-        {
-            WSASetLastError( WSAHOST_NOT_FOUND ); //WSANO_DATA  ??
-            return NULL;
-        }
-        return p->Hostent;
-    }
-
-    /* Is it an IPv6 address? */
-    found = strstr(name, ":");
-    if( found != NULL )
-    {
-        addr = GH_IPV6;
-        goto act;
-    }
-
-    /* Is it an IPv4 address? */
-    if (!isalpha(name[0]))
-    {
-        addr = GH_IPV4;
-        goto act;
-    }
-
-    addr = GH_RFC1123_DNS;
-
- /* Broken out in case we want to get fancy later */
- act:
-    switch(addr)
-    {
-        case GH_IPV6:
-            WSASetLastError(STATUS_NOT_IMPLEMENTED);
-            return NULL;
-        break;
-
-        case GH_INVALID:
-            WSASetLastError(WSAEFAULT);
-            return NULL;
-        break;
-
-        /* Note: If passed an IP address, MSDN says that gethostbyname()
-                 treats it as an unknown host.
-           This is different from the unix implementation. Use inet_addr()
-        */
-        case GH_IPV4:
-        case GH_RFC1123_DNS:
-        /* DNS_TYPE_A: include/WinDNS.h */
-        /* DnsQuery -- lib/dnsapi/dnsapi/query.c */
-
-        /* Look for the DNS name in the hosts file */
-        Hostent = FindEntryInHosts(name);
-        if (Hostent)
-           return Hostent;
-
-        dns_status = DnsQuery_A(name,
-                                DNS_TYPE_A,
-                                DNS_QUERY_STANDARD,
-                                0,
-                                /* extra dns servers */ &dp,
-                                0);
-
-        if(dns_status == 0)
-        {
-            //ASSERT(dp->wType == DNS_TYPE_A);
-            //ASSERT(dp->wDataLength == sizeof(DNS_A_DATA));
-            PDNS_RECORD curr;
-            for(curr=dp;
-                curr != NULL && curr->wType != DNS_TYPE_A;
-                curr = curr->pNext )
-            {
-                WS_DbgPrint(MID_TRACE,("wType: %i\n", curr->wType));
-                /*empty */
-            }
-
-            if(curr)
-            {
-                WS_DbgPrint(MID_TRACE,("populating hostent\n"));
-                WS_DbgPrint(MID_TRACE,("pName is (%s)\n", curr->pName));
-                populate_hostent(p->Hostent,
-                                 (PCHAR)curr->pName,
-                                 curr->Data.A.IpAddress);
-                DnsRecordListFree(dp, DnsFreeRecordList);
-                return p->Hostent;
-            }
-            else
-            {
-                DnsRecordListFree(dp, DnsFreeRecordList);
-            }
-        }
-
-        WS_DbgPrint(MID_TRACE,("Called DnsQuery, but host not found. Err: %i\n",
-                    dns_status));
-        WSASetLastError(WSAHOST_NOT_FOUND);
-        return NULL;
-
-        break;
-
-        default:
-            WSASetLastError(WSANO_RECOVERY);
-            return NULL;
-        break;
-    }
-
-    WSASetLastError(WSANO_RECOVERY);
-    return NULL;
-}
-
-/*
- * @implemented
- */
-INT
-EXPORT
-gethostname(OUT CHAR FAR* name,
-            IN  INT namelen)
-{
-    DWORD size = namelen;
-
-    int ret = GetComputerNameExA(ComputerNameDnsHostname,
-                                 name,
-                                 &size);
-    if(ret == 0)
-    {
-        WSASetLastError(WSAEFAULT);
-        return SOCKET_ERROR;
-    }
-    else
-    {
-        name[namelen-1] = '\0';
-        return 0;
-    }
-}
-
-
-/*
- * XXX arty -- Partial implementation pending a better one.  This one will
- * do for normal purposes.#include <ws2_32.h>
- *
- * Return the address of a static LPPROTOENT corresponding to the named
- * protocol.  These structs aren't very interesting, so I'm not too ashamed
- * to have this function work on builtins for now.
- *
- * @unimplemented
- */
-
-static CHAR *no_aliases = 0;
-static PROTOENT protocols[] =
-{
-    {"icmp",&no_aliases, IPPROTO_ICMP},
-    {"tcp", &no_aliases, IPPROTO_TCP},
-    {"udp", &no_aliases, IPPROTO_UDP},
-    {NULL, NULL, 0}
-};
-
-LPPROTOENT
-EXPORT
-getprotobyname(IN  CONST CHAR FAR* name)
-{
-    UINT i;
-    for (i = 0; protocols[i].p_name; i++)
-    {
-       if (_stricmp(protocols[i].p_name, name) == 0)
-         return &protocols[i];
-    }
-    return NULL;
-}
-
-/*
- * @unimplemented
- */
-LPPROTOENT
-EXPORT
-getprotobynumber(IN  INT number)
-{
-    UINT i;
-    for (i = 0; protocols[i].p_name; i++)
-    {
-       if (protocols[i].p_proto == number)
-         return &protocols[i];
-    }
-    return NULL;
-}
-
-#define SKIPWS(ptr,act) \
-{while(*ptr && isspace(*ptr)) ptr++; if(!*ptr) act;}
-#define SKIPANDMARKSTR(ptr,act) \
-{while(*ptr && !isspace(*ptr)) ptr++; \
- if(!*ptr) {act;} else { *ptr = 0; ptr++; }}
-
-
-static BOOL
-DecodeServEntFromString(IN  PCHAR ServiceString,
-                        OUT PCHAR *ServiceName,
-                        OUT PCHAR *PortNumberStr,
-                        OUT PCHAR *ProtocolStr,
-                        IN  PCHAR *Aliases,
-                        IN  DWORD MaxAlias)
-{
-    UINT NAliases = 0;
-
-    WS_DbgPrint(MAX_TRACE, ("Parsing service ent [%s]\n", ServiceString));
-
-    SKIPWS(ServiceString, return FALSE);
-    *ServiceName = ServiceString;
-    SKIPANDMARKSTR(ServiceString, return FALSE);
-    SKIPWS(ServiceString, return FALSE);
-    *PortNumberStr = ServiceString;
-    SKIPANDMARKSTR(ServiceString, ;);
-
-    while( *ServiceString && NAliases < MaxAlias - 1 )
-    {
-        SKIPWS(ServiceString, break);
-        if( *ServiceString )
-        {
-            SKIPANDMARKSTR(ServiceString, ;);
-            if( strlen(ServiceString) )
-            {
-                WS_DbgPrint(MAX_TRACE, ("Alias: %s\n", ServiceString));
-                *Aliases++ = ServiceString;
-                NAliases++;
-            }
-        }
-    }
-    *Aliases = NULL;
-
-    *ProtocolStr = strchr(*PortNumberStr,'/');
-    if( !*ProtocolStr ) return FALSE;
-    **ProtocolStr = 0; (*ProtocolStr)++;
-
-    WS_DbgPrint(MAX_TRACE, ("Parsing done: %s %s %s %d\n",
-                *ServiceName, *ProtocolStr, *PortNumberStr,
-                NAliases));
-
-    return TRUE;
-}
-
-#define ADJ_PTR(p,b1,b2) p = (p - b1) + b2
-
-/*
- * @implemented
- */
-LPSERVENT
-EXPORT
-getservbyname(IN  CONST CHAR FAR* name,
-              IN  CONST CHAR FAR* proto)
-{
-    BOOL  Found = FALSE;
-    HANDLE ServicesFile;
-    CHAR ServiceDBData[BUFSIZ] = { 0 };
-    PCHAR SystemDirectory = ServiceDBData; /* Reuse this stack space */
-    PCHAR ServicesFileLocation = "\\drivers\\etc\\services";
-    PCHAR ThisLine = 0, NextLine = 0, ServiceName = 0, PortNumberStr = 0,
-    ProtocolStr = 0, Comment = 0, EndValid;
-    PCHAR Aliases[WS2_INTERNAL_MAX_ALIAS] = { 0 };
-    UINT i,SizeNeeded = 0,
-    SystemDirSize = sizeof(ServiceDBData) - 1;
-    DWORD ReadSize = 0;
-    PWINSOCK_THREAD_BLOCK p = NtCurrentTeb()->WinSockData;
-
-    if (!p || !WSAINITIALIZED)
-    {
-        WSASetLastError( WSANOTINITIALISED );
-        return NULL;
-    }
-
-    if( !name )
-    {
-        WSASetLastError( WSANO_RECOVERY );
-        return NULL;
-    }
-
-    if( !GetSystemDirectoryA( SystemDirectory, SystemDirSize ) )
-    {
-        WSASetLastError( WSANO_RECOVERY );
-        WS_DbgPrint(MIN_TRACE, ("Could not get windows system directory.\n"));
-        return NULL; /* Can't get system directory */
-    }
-
-    strncat(SystemDirectory,
-            ServicesFileLocation,
-            SystemDirSize );
-
-    ServicesFile = CreateFileA(SystemDirectory,
-                               GENERIC_READ,
-                               FILE_SHARE_READ,
-                               NULL,
-                               OPEN_EXISTING,
-                               FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
-                               NULL );
-
-    if( ServicesFile == INVALID_HANDLE_VALUE )
-    {
-        WSASetLastError( WSANO_RECOVERY );
-        return NULL;
-    }
-
-    /* Scan the services file ...
-    *
-    * We will be share the buffer on the lines. If the line does not fit in
-    * the buffer, then moving it to the beginning of the buffer and read
-    * the remnants of line from file.
-    */
-
-    /* Initial Read */
-    ReadFile(ServicesFile,
-                   ServiceDBData,
-                   sizeof( ServiceDBData ) - 1,
-                   &ReadSize, NULL );
-    ThisLine = NextLine = ServiceDBData;
-    EndValid = ServiceDBData + ReadSize;
-    ServiceDBData[sizeof(ServiceDBData) - 1] = '\0';
-
-    while(ReadSize)
-    {
-        for(; *NextLine != '\r' && *NextLine != '\n'; NextLine++)
-        {
-            if(NextLine == EndValid)
-            {
-                int LineLen = NextLine - ThisLine;
-
-                if(ThisLine == ServiceDBData)
-                {
-                    WS_DbgPrint(MIN_TRACE,("Line too long"));
-                    WSASetLastError( WSANO_RECOVERY );
-                    return NULL;
-                }
-
-                memmove(ServiceDBData, ThisLine, LineLen);
-
-                ReadFile(ServicesFile, ServiceDBData + LineLen,
-                         sizeof( ServiceDBData )-1 - LineLen,
-                         &ReadSize, NULL );
-
-                EndValid = ServiceDBData + LineLen + ReadSize;
-                NextLine = ServiceDBData + LineLen;
-                ThisLine = ServiceDBData;
-
-                if(!ReadSize) break;
-            }
-        }
-
-        *NextLine = '\0';
-        Comment = strchr( ThisLine, '#' );
-        if( Comment ) *Comment = '\0'; /* Terminate at comment start */
-
-        if(DecodeServEntFromString(ThisLine,
-                                   &ServiceName,
-                                   &PortNumberStr,
-                                   &ProtocolStr,
-                                   Aliases,
-                                   WS2_INTERNAL_MAX_ALIAS) &&
-           !strcmp( ServiceName, name ) &&
-           (proto ? !strcmp( ProtocolStr, proto ) : TRUE) )
-        {
-
-            WS_DbgPrint(MAX_TRACE,("Found the service entry.\n"));
-            Found = TRUE;
-            SizeNeeded = sizeof(WINSOCK_GETSERVBYNAME_CACHE) +
-                (NextLine - ThisLine);
-            break;
-        }
-        NextLine++;
-        ThisLine = NextLine;
-    }
-
-    /* This we'll do no matter what */
-    CloseHandle( ServicesFile );
-
-    if( !Found )
-    {
-        WS_DbgPrint(MAX_TRACE,("Not found\n"));
-        WSASetLastError( WSANO_DATA );
-        return NULL;
-    }
-
-    if( !p->Getservbyname || p->Getservbyname->Size < SizeNeeded )
-    {
-        /* Free previous getservbyname buffer, allocate bigger */
-        if( p->Getservbyname )
-            HeapFree(GlobalHeap, 0, p->Getservbyname);
-        p->Getservbyname = HeapAlloc(GlobalHeap, 0, SizeNeeded);
-        if( !p->Getservbyname )
-        {
-            WS_DbgPrint(MIN_TRACE,("Couldn't allocate %d bytes\n",
-                        SizeNeeded));
-            WSASetLastError( WSATRY_AGAIN );
-            return NULL;
-        }
-        p->Getservbyname->Size = SizeNeeded;
-    }
-
-    /* Copy the data */
-    memmove(p->Getservbyname->Data,
-            ThisLine,
-            NextLine - ThisLine );
-
-    ADJ_PTR(ServiceName,ThisLine,p->Getservbyname->Data);
-    ADJ_PTR(ProtocolStr,ThisLine,p->Getservbyname->Data);
-    WS_DbgPrint(MAX_TRACE, ("ServiceName: %s, Protocol: %s\n",
-                ServiceName,
-                ProtocolStr));
-
-    for( i = 0; Aliases[i]; i++ )
-    {
-        ADJ_PTR(Aliases[i],ThisLine,p->Getservbyname->Data);
-        WS_DbgPrint(MAX_TRACE,("Aliase %d: %s\n", i, Aliases[i]));
-    }
-
-    memcpy(p->Getservbyname->Aliases,
-           Aliases,
-           sizeof(Aliases));
-
-    /* Create the struct proper */
-    p->Getservbyname->ServerEntry.s_name = ServiceName;
-    p->Getservbyname->ServerEntry.s_aliases = p->Getservbyname->Aliases;
-    p->Getservbyname->ServerEntry.s_port = htons(atoi(PortNumberStr));
-    p->Getservbyname->ServerEntry.s_proto = ProtocolStr;
-
-    return &p->Getservbyname->ServerEntry;
-}
-
-
-/*
- * @implemented
- */
-LPSERVENT
-EXPORT
-getservbyport(IN  INT port,
-              IN  CONST CHAR FAR* proto)
-{
-    BOOL  Found = FALSE;
-    HANDLE ServicesFile;
-    CHAR ServiceDBData[BUFSIZ] = { 0 };
-    PCHAR SystemDirectory = ServiceDBData; /* Reuse this stack space */
-    PCHAR ServicesFileLocation = "\\drivers\\etc\\services";
-    PCHAR ThisLine = 0, NextLine = 0, ServiceName = 0, PortNumberStr = 0,
-    ProtocolStr = 0, Comment = 0;
-    PCHAR Aliases[WS2_INTERNAL_MAX_ALIAS] = { 0 };
-    UINT i,SizeNeeded = 0,
-    SystemDirSize = sizeof(ServiceDBData) - 1;
-    DWORD ReadSize = 0, ValidData = 0;
-    PWINSOCK_THREAD_BLOCK p = NtCurrentTeb()->WinSockData;
-
-    if( !p || !WSAINITIALIZED)
-    {
-        WSASetLastError( WSANOTINITIALISED );
-        return NULL;
-    }
-
-    if ( !port )
-    {
-        WSASetLastError( WSANO_RECOVERY );
-        return NULL;
-    }
-
-    if( !GetSystemDirectoryA( SystemDirectory, SystemDirSize ) )
-    {
-        WSASetLastError( WSANO_RECOVERY );
-        WS_DbgPrint(MIN_TRACE, ("Could not get windows system directory.\n"));
-        return NULL; /* Can't get system directory */
-    }
-
-    strncat(SystemDirectory,
-            ServicesFileLocation,
-            SystemDirSize );
-
-    ServicesFile = CreateFileA(SystemDirectory,
-                               GENERIC_READ,
-                               FILE_SHARE_READ,
-                               NULL,
-                               OPEN_EXISTING,
-                               FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
-                               NULL );
-
-    if( ServicesFile == INVALID_HANDLE_VALUE )
-    {
-        WSASetLastError( WSANO_RECOVERY );
-        return NULL;
-    }
-
-    /* Scan the services file ...
-     *
-     * We will read up to BUFSIZ bytes per pass, until the buffer does not
-     * contain a full line, then we will try to read more.
-     *
-     * We fall from the loop if the buffer does not have a line terminator.
-     */
-
-    /* Initial Read */
-    while(!Found &&
-          ReadFile(ServicesFile,
-                   ServiceDBData + ValidData,
-                   sizeof( ServiceDBData ) - ValidData,
-                   &ReadSize, NULL ) )
-    {
-        ValidData += ReadSize;
-        ReadSize = 0;
-        NextLine = ThisLine = ServiceDBData;
-
-        /* Find the beginning of the next line */
-        while( NextLine < ServiceDBData + ValidData &&
-               *NextLine != '\r' && *NextLine != '\n' ) NextLine++;
-
-        /* Zero and skip, so we can treat what we have as a string */
-        if( NextLine > ServiceDBData + ValidData )
-            break;
-
-        *NextLine = 0; NextLine++;
-
-        Comment = strchr( ThisLine, '#' );
-        if( Comment ) *Comment = 0; /* Terminate at comment start */
-
-        if(DecodeServEntFromString(ThisLine,
-                                   &ServiceName,
-                                   &PortNumberStr,
-                                   &ProtocolStr,
-                                   Aliases,
-                                   WS2_INTERNAL_MAX_ALIAS ) &&
-           (htons(atoi( PortNumberStr )) == port ) &&
-           (proto ? !strcmp( ProtocolStr, proto ) : TRUE) )
-        {
-
-            WS_DbgPrint(MAX_TRACE,("Found the port entry.\n"));
-
-            Found = TRUE;
-            SizeNeeded = sizeof(WINSOCK_GETSERVBYPORT_CACHE) +
-            (NextLine - ThisLine);
-            break;
-        }
-
-        /* Get rid of everything we read so far */
-        while( NextLine <= ServiceDBData + ValidData &&
-               isspace( *NextLine ) )
-        {
-            NextLine++;
-        }
-
-        WS_DbgPrint(MAX_TRACE,("About to move %d chars\n",
-                    ServiceDBData + ValidData - NextLine));
-
-        memmove(ServiceDBData,
-                NextLine,
-                ServiceDBData + ValidData - NextLine );
-        ValidData -= NextLine - ServiceDBData;
-        WS_DbgPrint(MAX_TRACE,("Valid bytes: %d\n", ValidData));
-    }
-
-    /* This we'll do no matter what */
-    CloseHandle( ServicesFile );
-
-    if( !Found )
-    {
-        WS_DbgPrint(MAX_TRACE,("Not found\n"));
-        WSASetLastError( WSANO_DATA );
-        return NULL;
-    }
-
-    if( !p->Getservbyport || p->Getservbyport->Size < SizeNeeded )
-    {
-        /* Free previous getservbyport buffer, allocate bigger */
-        if( p->Getservbyport )
-            HeapFree(GlobalHeap, 0, p->Getservbyport);
-        p->Getservbyport = HeapAlloc(GlobalHeap,
-                                     0,
-                                     SizeNeeded);
-        if( !p->Getservbyport )
-        {
-            WS_DbgPrint(MIN_TRACE,("Couldn't allocate %d bytes\n",
-                        SizeNeeded));
-            WSASetLastError( WSATRY_AGAIN );
-            return NULL;
-        }
-        p->Getservbyport->Size = SizeNeeded;
-    }
-    /* Copy the data */
-    memmove(p->Getservbyport->Data,
-            ThisLine,
-            NextLine - ThisLine );
-
-    ADJ_PTR(PortNumberStr,ThisLine,p->Getservbyport->Data);
-    ADJ_PTR(ProtocolStr,ThisLine,p->Getservbyport->Data);
-    WS_DbgPrint(MAX_TRACE, ("Port Number: %s, Protocol: %s\n",
-                PortNumberStr, ProtocolStr));
-
-    for( i = 0; Aliases[i]; i++ )
-    {
-        ADJ_PTR(Aliases[i],ThisLine,p->Getservbyport->Data);
-        WS_DbgPrint(MAX_TRACE,("Aliases %d: %s\n", i, Aliases[i]));
-    }
-
-    memcpy(p->Getservbyport->Aliases,Aliases,sizeof(Aliases));
-
-    /* Create the struct proper */
-    p->Getservbyport->ServerEntry.s_name = ServiceName;
-    p->Getservbyport->ServerEntry.s_aliases = p->Getservbyport->Aliases;
-    p->Getservbyport->ServerEntry.s_port = port;
-    p->Getservbyport->ServerEntry.s_proto = ProtocolStr;
-
-    WS_DbgPrint(MID_TRACE,("s_name: %s\n", ServiceName));
-
-    return &p->Getservbyport->ServerEntry;
-
-}
-
-
-/*
- * @implemented
- */
-ULONG
-EXPORT
-inet_addr(IN  CONST CHAR FAR* cp)
-/*
- * FUNCTION: Converts a string containing an IPv4 address to an unsigned long
- * ARGUMENTS:
- *     cp = Pointer to string with address to convert
- * RETURNS:
- *     Binary representation of IPv4 address, or INADDR_NONE
- */
-{
-    UINT i;
-    PCHAR p;
-    ULONG u = 0;
-
-    p = (PCHAR)cp;
-
-    if (!p)
-    {
-        WSASetLastError(WSAEFAULT);
-        return INADDR_NONE;
-    }
-
-    if (strlen(p) == 0)
-        return INADDR_NONE;
-
-    if (strcmp(p, " ") == 0)
-        return 0;
-
-    for (i = 0; i <= 3; i++)
-    {
-        u += (strtoul(p, &p, 0) << (i * 8));
-
-        if (strlen(p) == 0)
-            return u;
-
-        if (p[0] != '.')
-            return INADDR_NONE;
-
-        p++;
-    }
-
-    return u;
-}
-
-
-/*
- * @implemented
- */
-CHAR FAR*
-EXPORT
-inet_ntoa(IN  IN_ADDR in)
-{
-    CHAR b[10];
-    PCHAR p;
-
-    p = ((PWINSOCK_THREAD_BLOCK)NtCurrentTeb()->WinSockData)->Intoa;
-    _itoa(in.S_un.S_addr & 0xFF, b, 10);
-    strcpy(p, b);
-    _itoa((in.S_un.S_addr >> 8) & 0xFF, b, 10);
-    strcat(p, ".");
-    strcat(p, b);
-    _itoa((in.S_un.S_addr >> 16) & 0xFF, b, 10);
-    strcat(p, ".");
-    strcat(p, b);
-    _itoa((in.S_un.S_addr >> 24) & 0xFF, b, 10);
-    strcat(p, ".");
-    strcat(p, b);
-
-    return (CHAR FAR*)p;
-}
-
-
-/*
- * @implemented
- */
-VOID
-EXPORT
-freeaddrinfo(struct addrinfo *pAddrInfo)
-{
-    struct addrinfo *next, *cur;
-    cur = pAddrInfo;
-    while (cur)
-    {
-        next = cur->ai_next;
-        if (cur->ai_addr)
-          HeapFree(GetProcessHeap(), 0, cur->ai_addr);
-        if (cur->ai_canonname)
-          HeapFree(GetProcessHeap(), 0, cur->ai_canonname);
-        HeapFree(GetProcessHeap(), 0, cur);
-        cur = next;
-    }
-}
-
-
-struct addrinfo *
-new_addrinfo(struct addrinfo *prev)
-{
-    struct addrinfo *ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct addrinfo));
-    if (prev)
-      prev->ai_next = ret;
-    return ret;
-}
-
-/*
- * @implemented
- */
-INT
-EXPORT
-getaddrinfo(const char FAR * nodename,
-            const char FAR * servname,
-            const struct addrinfo FAR * hints,
-            struct addrinfo FAR * FAR * res)
-{
-    struct addrinfo *ret = NULL, *ai;
-    ULONG addr;
-    USHORT port;
-    PCHAR pc;
-    struct servent *se;
-    char *proto;
-    LPPROTOENT pent;
-    DNS_STATUS dns_status;
-    PDNS_RECORD dp, currdns;
-    struct sockaddr_in *sin;
-    INT error;
-
-    if (!WSAINITIALIZED)
-    {
-        error = WSANOTINITIALISED;
-        goto End;
-    }
-
-    *res = NULL;
-
-    if (nodename == NULL && servname == NULL)
-    {
-        error = WSAHOST_NOT_FOUND;
-        goto End;
-    }
-
-    if (servname)
-    {
-        /* converting port number */
-        port = strtoul(servname, &pc, 10);
-        /* service name was specified? */
-        if (*pc != ANSI_NULL)
-        {
-            /* protocol was specified? */
-            if (hints && hints->ai_protocol)
-            {
-                pent = getprotobynumber(hints->ai_protocol);
-                if (pent == NULL)
-                {
-                  error = WSAEINVAL;
-                  goto End;
-                }
-                proto = pent->p_name;
-            }
-            else
-                proto = NULL;
-            se = getservbyname(servname, proto);
-            if (se == NULL)
-            {
-                error = WSATYPE_NOT_FOUND;
-                goto End;
-            }
-            port = se->s_port;
-        }
-        else
-            port = htons(port);
-    }
-    else
-        port = 0;
-
-    if (nodename)
-    {
-        /* Is it an IPv6 address? */
-        if (strstr(nodename, ":"))
-        {
-            error = WSAHOST_NOT_FOUND;
-            goto End;
-        }
-
-        /* Is it an IPv4 address? */
-        addr = inet_addr(nodename);
-        if (addr != INADDR_NONE)
-        {
-            ai = new_addrinfo(NULL);
-            ai->ai_family = PF_INET;
-            ai->ai_addrlen = sizeof(struct sockaddr_in);
-            ai->ai_addr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ai->ai_addrlen);
-            sin = (struct sockaddr_in *)ai->ai_addr;
-            sin->sin_family = AF_INET;
-            sin->sin_port = port;
-            RtlCopyMemory(&sin->sin_addr, &addr, sizeof(sin->sin_addr));
-            if (hints)
-            {
-                if (ai->ai_socktype == 0)
-                    ai->ai_socktype = hints->ai_socktype;
-                if (ai->ai_protocol == 0)
-                    ai->ai_protocol = hints->ai_protocol;
-            }
-            ret = ai;
-        }
-        else
-        {
-           /* resolving host name */
-            dns_status = DnsQuery_A(nodename,
-                                    DNS_TYPE_A,
-                                    DNS_QUERY_STANDARD,
-                                    0,
-                                    /* extra dns servers */ &dp,
-                                    0);
-
-            if (dns_status == 0)
-            {
-                ai = NULL;
-                for (currdns = dp; currdns; currdns = currdns->pNext )
-                {
-                    /* accept only A records */
-                    if (currdns->wType != DNS_TYPE_A) continue;
-
-                    ai = new_addrinfo(ai);
-                    if (ret == NULL)
-                      ret = ai;
-                    ai->ai_family = PF_INET;
-                    ai->ai_addrlen = sizeof(struct sockaddr_in);
-                    ai->ai_addr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ai->ai_addrlen);
-                    sin = (struct sockaddr_in *)ret->ai_addr;
-                    sin->sin_family = AF_INET;
-                    sin->sin_port = port;
-                    RtlCopyMemory(&sin->sin_addr, &currdns->Data.A.IpAddress, sizeof(sin->sin_addr));
-                    if (hints)
-                    {
-                        if (ai->ai_socktype == 0)
-                            ai->ai_socktype = hints->ai_socktype;
-                        if (ai->ai_protocol == 0)
-                            ai->ai_protocol = hints->ai_protocol;
-                    }
-                }
-                DnsRecordListFree(dp, DnsFreeRecordList);
-            }
-        }
-    }
-    else
-    {
-        ai = new_addrinfo(NULL);
-        ai->ai_family = PF_INET;
-        ai->ai_addrlen = sizeof(struct sockaddr_in);
-        ai->ai_addr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ai->ai_addrlen);
-        sin = (struct sockaddr_in *)ai->ai_addr;
-        sin->sin_family = AF_INET;
-        sin->sin_port = port;
-        if (hints)
-        {
-            if (!(hints->ai_flags & AI_PASSIVE))
-            {
-                sin->sin_addr.S_un.S_un_b.s_b1 = 127;
-                sin->sin_addr.S_un.S_un_b.s_b2 = 0;
-                sin->sin_addr.S_un.S_un_b.s_b3 = 0;
-                sin->sin_addr.S_un.S_un_b.s_b4 = 1;
-            }
-            if (ai->ai_socktype == 0)
-                ai->ai_socktype = hints->ai_socktype;
-            if (ai->ai_protocol == 0)
-                ai->ai_protocol = hints->ai_protocol;
-        }
-        ret = ai;
-    }
-
-    if (ret == NULL)
-    {
-        error = WSAHOST_NOT_FOUND;
-        goto End;
-    }
-
-    if (hints && hints->ai_family != PF_UNSPEC && hints->ai_family != PF_INET)
-    {
-        freeaddrinfo(ret);
-        error = WSAEAFNOSUPPORT;
-        goto End;
-    }
-
-    *res = ret;
-    error = 0;
-
-End:
-    WSASetLastError(error);
-    return error;
-}
-
-/* EOF */
diff --git a/dll/win32/ws2_32/misc/sndrcv.c b/dll/win32/ws2_32/misc/sndrcv.c
deleted file mode 100644 (file)
index cb60788..0000000
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/misc/sndrcv.c
- * PURPOSE:     Send/receive functions
- * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
- * REVISIONS:
- *   CSH 01/09-2000 Created
- */
-
-#include "ws2_32.h"
-
-/*
- * @implemented
- */
-INT
-EXPORT
-recv(IN  SOCKET s,
-     OUT CHAR FAR* buf,
-     IN  INT len,
-     IN  INT flags)
-{
-    DWORD Error;
-    DWORD BytesReceived;
-    WSABUF WSABuf;
-
-    WS_DbgPrint(MAX_TRACE, ("s (0x%X)  buf (0x%X)  len (0x%X) flags (0x%X).\n",
-                s,
-                buf,
-                len,
-                flags));
-
-    WSABuf.len = len;
-    WSABuf.buf = (CHAR FAR*)buf;
-
-    Error = WSARecv(s,
-                    &WSABuf,
-                    1,
-                    &BytesReceived,
-                    (LPDWORD)&flags,
-                    NULL,
-                    NULL);
-
-    if( Error )
-        return -1;
-    else
-        return BytesReceived;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-recvfrom(IN      SOCKET s,
-         OUT     CHAR FAR* buf,
-         IN      INT len,
-         IN      INT flags,
-         OUT     LPSOCKADDR from,
-         IN OUT  INT FAR* fromlen)
-{
-    DWORD Error;
-    DWORD BytesReceived;
-    WSABUF WSABuf;
-
-    WS_DbgPrint(MAX_TRACE, ("s (0x%X)  buf (0x%X)  len (0x%X) flags (0x%X).\n",
-                s,
-                buf,
-                len,
-                flags));
-
-    WSABuf.len = len;
-    WSABuf.buf = (CHAR FAR*)buf;
-
-    Error = WSARecvFrom(s,
-                        &WSABuf,
-                        1,
-                        &BytesReceived,
-                        (LPDWORD)&flags,
-                        from,
-                        fromlen,
-                        NULL,
-                        NULL);
-
-    if( Error )
-        return -1;
-    else
-        return BytesReceived;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-send(IN  SOCKET s,
-     IN  CONST CHAR FAR* buf,
-     IN  INT len,
-     IN  INT flags)
-{
-    DWORD BytesSent;
-    DWORD Error;
-    WSABUF WSABuf;
-
-    WS_DbgPrint(MAX_TRACE, ("s (0x%X)  buf (0x%X)  len (0x%X) flags (0x%X).\n",
-                s,
-                buf,
-                len,
-                flags));
-
-    WSABuf.len = len;
-    WSABuf.buf = (CHAR FAR*)buf;
-
-    Error = WSASend(s,
-                    &WSABuf,
-                    1,
-                    &BytesSent,
-                    flags,
-                    NULL,
-                    NULL);
-
-    if( Error )
-    {
-        WS_DbgPrint(MAX_TRACE,("Reporting error %d\n", Error));
-        return -1;
-    }
-    else
-    {
-        WS_DbgPrint(MAX_TRACE,("Read %d bytes\n", BytesSent));
-        return BytesSent;
-    }
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-sendto(IN  SOCKET s,
-       IN  CONST CHAR FAR* buf,
-       IN  INT len,
-       IN  INT flags,
-       IN  CONST struct sockaddr *to,
-       IN  INT tolen)
-{
-    DWORD Error;
-    DWORD BytesSent;
-    WSABUF WSABuf;
-
-    WS_DbgPrint(MAX_TRACE, ("s (0x%X)  buf (0x%X)  len (0x%X) flags (0x%X).\n",
-                s,
-                buf,
-                len,
-                flags));
-
-    WSABuf.len = len;
-    WSABuf.buf = (CHAR FAR*)buf;
-
-    Error = WSASendTo(s,
-                      &WSABuf,
-                      1,
-                      &BytesSent,
-                      flags,
-                      to,
-                      tolen,
-                      NULL,
-                      NULL);
-
-    if( Error )
-        return -1;
-    else
-        return BytesSent;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSARecv(IN      SOCKET s,
-        IN OUT  LPWSABUF lpBuffers,
-        IN      DWORD dwBufferCount,
-        OUT     LPDWORD lpNumberOfBytesRecvd,
-        IN OUT  LPDWORD lpFlags,
-        IN      LPWSAOVERLAPPED lpOverlapped,
-        IN      LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
-{
-    PCATALOG_ENTRY Provider;
-    INT Errno;
-    INT Code;
-
-    WS_DbgPrint(MAX_TRACE, ("Called.\n"));
-
-    if (!ReferenceProviderByHandle((HANDLE)s,
-                                   &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    assert(Provider->ProcTable.lpWSPRecv);
-
-    Code = Provider->ProcTable.lpWSPRecv(s,
-                                         lpBuffers,
-                                         dwBufferCount,
-                                         lpNumberOfBytesRecvd,
-                                         lpFlags,
-                                         lpOverlapped,
-                                         lpCompletionRoutine,
-                                         NULL /* lpThreadId */,
-                                         &Errno);
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Code == SOCKET_ERROR)
-        WSASetLastError(Errno);
-
-    return Code;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSARecvDisconnect(IN  SOCKET s,
-                  OUT LPWSABUF lpInboundDisconnectData)
-{
-    UNIMPLEMENTED
-
-    return 0;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSARecvFrom(IN      SOCKET s,
-            IN OUT  LPWSABUF lpBuffers,
-            IN      DWORD dwBufferCount,
-            OUT     LPDWORD lpNumberOfBytesRecvd,
-            IN OUT  LPDWORD lpFlags,
-            OUT     LPSOCKADDR lpFrom,
-            IN OUT  LPINT lpFromlen,
-            IN      LPWSAOVERLAPPED lpOverlapped,
-            IN      LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
-{
-    PCATALOG_ENTRY Provider;
-    INT Errno;
-    INT Code;
-
-    WS_DbgPrint(MAX_TRACE, ("Called.\n"));
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    assert(Provider->ProcTable.lpWSPRecvFrom);
-
-    Code = Provider->ProcTable.lpWSPRecvFrom(s,
-                                             lpBuffers,
-                                             dwBufferCount,
-                                             lpNumberOfBytesRecvd,
-                                             lpFlags,
-                                             lpFrom,
-                                             lpFromlen,
-                                             lpOverlapped,
-                                             lpCompletionRoutine,
-                                             NULL /* lpThreadId */,
-                                             &Errno);
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Code == SOCKET_ERROR)
-        WSASetLastError(Errno);
-
-    return Code;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSASend(IN  SOCKET s,
-        IN  LPWSABUF lpBuffers,
-        IN  DWORD dwBufferCount,
-        OUT LPDWORD lpNumberOfBytesSent,
-        IN  DWORD dwFlags,
-        IN  LPWSAOVERLAPPED lpOverlapped,
-        IN  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
-{
-    PCATALOG_ENTRY Provider;
-    INT Errno;
-    INT Code;
-
-    WS_DbgPrint(MAX_TRACE, ("Called.\n"));
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    assert(Provider->ProcTable.lpWSPSend);
-
-    Code = Provider->ProcTable.lpWSPSend(s,
-                                         lpBuffers,
-                                         dwBufferCount,
-                                         lpNumberOfBytesSent,
-                                         dwFlags,
-                                         lpOverlapped,
-                                         lpCompletionRoutine,
-                                         NULL /* lpThreadId */,
-                                         &Errno);
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Code == SOCKET_ERROR)
-        WSASetLastError(Errno);
-
-    return Code;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSASendDisconnect(IN  SOCKET s,
-                  IN  LPWSABUF lpOutboundDisconnectData)
-{
-    UNIMPLEMENTED
-
-    return 0;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSASendTo(IN  SOCKET s,
-          IN  LPWSABUF lpBuffers,
-          IN  DWORD dwBufferCount,
-          OUT LPDWORD lpNumberOfBytesSent,
-          IN  DWORD dwFlags,
-          IN  CONST struct sockaddr *lpTo,
-          IN  INT iToLen,
-          IN  LPWSAOVERLAPPED lpOverlapped,
-          IN  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
-{
-    PCATALOG_ENTRY Provider;
-    INT Errno;
-    INT Code;
-
-    WS_DbgPrint(MAX_TRACE, ("Called.\n"));
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    assert(Provider->ProcTable.lpWSPSendTo);
-
-#if (__W32API_MAJOR_VERSION < 2 || __W32API_MINOR_VERSION < 5)
-    Code = Provider->ProcTable.lpWSPSendTo(s,
-                                           lpBuffers,
-                                           dwBufferCount,
-                                           lpNumberOfBytesSent,
-                                           dwFlags,
-                                           (CONST LPSOCKADDR)lpTo,
-                                           iToLen,
-                                           lpOverlapped,
-                                           lpCompletionRoutine,
-                                           NULL /* lpThreadId */,
-                                           &Errno);
-#else
-    Code = Provider->ProcTable.lpWSPSendTo(s,
-                                           lpBuffers,
-                                           dwBufferCount,
-                                           lpNumberOfBytesSent,
-                                           dwFlags,
-                                           lpTo,
-                                           iToLen,
-                                           lpOverlapped,
-                                           lpCompletionRoutine,
-                                           NULL /* lpThreadId */,
-                                           &Errno);
-#endif /* __W32API_MAJOR_VERSION < 2 || __W32API_MINOR_VERSION < 5 */
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Code == SOCKET_ERROR)
-        WSASetLastError(Errno);
-    else
-        WSASetLastError(0);
-
-    return Code;
-}
-
-/* EOF */
diff --git a/dll/win32/ws2_32/misc/stubs.c b/dll/win32/ws2_32/misc/stubs.c
deleted file mode 100644 (file)
index 98e1346..0000000
+++ /dev/null
@@ -1,1035 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/misc/stubs.c
- * PURPOSE:     Stubs
- * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
- * REVISIONS:
- *   CSH 01/09-2000 Created
- */
-
-#include "ws2_32.h"
-
-#include <ws2tcpip.h>
-#include <strsafe.h>
-
-/*
- * @implemented
- */
-INT
-EXPORT
-getpeername(IN     SOCKET s,
-            OUT    LPSOCKADDR name,
-            IN OUT INT FAR* namelen)
-{
-    int Error;
-    INT Errno;
-    PCATALOG_ENTRY Provider;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)(ULONG_PTR)(s), &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    Error = Provider->ProcTable.lpWSPGetPeerName(s,
-                                                 name,
-                                                 namelen,
-                                                 &Errno);
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Error == SOCKET_ERROR)
-    {
-        WSASetLastError(Errno);
-    }
-
-    return Error;
-}
-
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-getsockname(IN     SOCKET s,
-            OUT    LPSOCKADDR name,
-            IN OUT INT FAR* namelen)
-{
-    int Error;
-    INT Errno;
-    PCATALOG_ENTRY Provider;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s,
-                                   &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    Error = Provider->ProcTable.lpWSPGetSockName(s,
-                                                 name,
-                                                 namelen,
-                                                 &Errno);
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Error == SOCKET_ERROR)
-    {
-        WSASetLastError(Errno);
-    }
-
-    return Error;
-}
-
-INT
-WSAAPI
-MapUnicodeProtocolInfoToAnsi(IN LPWSAPROTOCOL_INFOW UnicodeInfo,
-                             OUT LPWSAPROTOCOL_INFOA AnsiInfo)
-{
-    INT ReturnValue;
-
-    /* Copy all the data that doesn't need converting */
-    RtlCopyMemory(AnsiInfo,
-                  UnicodeInfo,
-                  FIELD_OFFSET(WSAPROTOCOL_INFOA, szProtocol));
-
-    /* Now convert the protocol string */
-    ReturnValue = WideCharToMultiByte(CP_ACP,
-                                      0,
-                                      UnicodeInfo->szProtocol,
-                                      -1,
-                                      AnsiInfo->szProtocol,
-                                      sizeof(AnsiInfo->szProtocol),
-                                      NULL,
-                                      NULL);
-    if (!ReturnValue) return WSASYSCALLFAILURE;
-
-    /* Return success */
-    return ERROR_SUCCESS;
-}
-
-/*
- * @implemented
- */
-INT
-EXPORT
-getsockopt(IN      SOCKET s,
-           IN      INT level,
-           IN      INT optname,
-           OUT     CHAR FAR* optval,
-           IN OUT  INT FAR* optlen)
-{
-    PCATALOG_ENTRY Provider;
-    INT Errno;
-    int Error;
-    WSAPROTOCOL_INFOW ProtocolInfo;
-    PCHAR OldOptVal = NULL;
-    INT OldOptLen = 0;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s,
-                                   &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    /* Check if ANSI data was requested */
-    if ((level == SOL_SOCKET) && (optname == SO_PROTOCOL_INFOA))
-    {
-        /* Validate size and pointers */
-        Errno = NO_ERROR;
-        _SEH2_TRY
-        {
-            if (!(optval) ||
-                !(optlen) ||
-                (*optlen < sizeof(WSAPROTOCOL_INFOA)))
-            {
-                /* Set return size and error code */
-                *optlen = sizeof(WSAPROTOCOL_INFOA);
-                Errno = WSAEFAULT;
-                _SEH2_LEAVE;
-            }
-
-            /* It worked. Save the values */
-            OldOptLen = *optlen;
-            OldOptVal = optval;
-
-            /* Hack them so WSP will know how to deal with it */
-            *optlen = sizeof(WSAPROTOCOL_INFOW);
-            optval = (PCHAR)&ProtocolInfo;
-            optname = SO_PROTOCOL_INFOW;
-        }
-        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
-        {
-            Errno = WSAEFAULT;
-        }
-        _SEH2_END;
-
-        /* Did we encounter invalid parameters? */
-        if (Errno != NO_ERROR)
-        {
-            /* Fail */
-            Error = SOCKET_ERROR;
-            goto Exit;
-        }
-    }
-
-    Error = Provider->ProcTable.lpWSPGetSockOpt(s,
-                                                level,
-                                                optname,
-                                                optval,
-                                                optlen,
-                                                &Errno);
-
-    /* Did we use the A->W hack? */
-    if (Error == ERROR_SUCCESS && OldOptVal)
-    {
-        /* We did, so we have to convert the unicode info to ansi */
-        Errno = MapUnicodeProtocolInfoToAnsi(&ProtocolInfo,
-                                             (LPWSAPROTOCOL_INFOA)
-                                             OldOptVal);
-
-        /* Return the length */
-        _SEH2_TRY
-        {
-            *optlen = OldOptLen;
-        }
-        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
-        {
-            Errno = WSAEFAULT;
-            Error = SOCKET_ERROR;
-        }
-        _SEH2_END;
-    }
-
-Exit:
-    DereferenceProviderByPointer(Provider);
-
-    if (Error == SOCKET_ERROR)
-    {
-        WSASetLastError(Errno);
-    }
-
-    return Error;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT __stdcall
-setsockopt(IN  SOCKET s,
-           IN  INT level,
-           IN  INT optname,
-           IN  CONST CHAR FAR* optval,
-           IN  INT optlen)
-{
-    PCATALOG_ENTRY Provider;
-    INT Errno;
-    int Error;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if(IS_INTRESOURCE(optval))
-    {
-        SetLastError(WSAEFAULT);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    Error = Provider->ProcTable.lpWSPSetSockOpt(s,
-                                                  level,
-                                                optname,
-                                                optval,
-                                                optlen,
-                                                &Errno);
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Error == SOCKET_ERROR)
-    {
-        WSASetLastError(Errno);
-    }
-
-    return Error;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-shutdown(IN  SOCKET s,
-         IN  INT how)
-{
-    PCATALOG_ENTRY Provider;
-    INT Errno;
-    int Error;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    Error = Provider->ProcTable.lpWSPShutdown(s,
-                                              how,
-                                              &Errno);
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Error == SOCKET_ERROR)
-    {
-        WSASetLastError(Errno);
-    }
-
-    return Error;
-}
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSAAsyncSelect(IN  SOCKET s,
-               IN  HWND hWnd,
-               IN  UINT wMsg,
-               IN  LONG lEvent)
-{
-    PCATALOG_ENTRY Provider;
-    INT Errno;
-    int Error;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    Error = Provider->ProcTable.lpWSPAsyncSelect(s,
-                                                 hWnd,
-                                                 wMsg,
-                                                 lEvent,
-                                                 &Errno);
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Error == SOCKET_ERROR)
-    {
-        WSASetLastError(Errno);
-    }
-
-    return Error;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSACancelBlockingCall(VOID)
-{
-#if 0
-    INT Errno;
-    int Error;
-    PCATALOG_ENTRY Provider;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    Error = Provider->ProcTable.lpWSPCancelBlockingCall(&Errno);
-
-    DereferenceProviderByPointer(Provider);
-
-    if (Error == SOCKET_ERROR)
-    {
-        WSASetLastError(Errno);
-    }
-
-    return Error;
-#endif
-
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSADuplicateSocketA(IN  SOCKET s,
-                    IN  DWORD dwProcessId,
-                    OUT LPWSAPROTOCOL_INFOA lpProtocolInfo)
-{
-#if 0
-    WSAPROTOCOL_INFOA ProtocolInfoU;
-
-    Error  = WSADuplicateSocketW(s,
-                               dwProcessId,
-                               &ProtocolInfoU);
-
-    if (Error == NO_ERROR)
-    {
-        UnicodeToAnsi(lpProtocolInfo,
-                      ProtocolInfoU,
-                      sizeof(
-
-    }
-
-    return Error;
-#endif
-
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-
-/*
- * @implemented
- */
-INT
-EXPORT
-WSADuplicateSocketW(IN  SOCKET s,
-                    IN  DWORD dwProcessId,
-                    OUT LPWSAPROTOCOL_INFOW lpProtocolInfo)
-{
-    INT Errno;
-    int Error;
-    PCATALOG_ENTRY Provider;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    Error = Provider->ProcTable.lpWSPDuplicateSocket(s,
-                                                     dwProcessId,
-                                                     lpProtocolInfo,
-                                                     &Errno);
-    DereferenceProviderByPointer(Provider);
-
-    if (Error == SOCKET_ERROR)
-    {
-        WSASetLastError(Errno);
-    }
-
-    return Error;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAEnumProtocolsA(IN      LPINT lpiProtocols,
-                  OUT     LPWSAPROTOCOL_INFOA lpProtocolBuffer,
-                  IN OUT  LPDWORD lpdwBufferLength)
-{
-    UNIMPLEMENTED
-
-    if (lpProtocolBuffer)
-    {
-        RtlZeroMemory(lpProtocolBuffer, *lpdwBufferLength);
-    }
-    *lpdwBufferLength = sizeof(WSAPROTOCOL_INFOA);
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAEnumProtocolsW(IN      LPINT lpiProtocols,
-                  OUT     LPWSAPROTOCOL_INFOW lpProtocolBuffer,
-                  IN OUT  LPDWORD lpdwBufferLength)
-{
-    UNIMPLEMENTED
-
-    if (lpProtocolBuffer)
-    {
-        RtlZeroMemory(lpProtocolBuffer, *lpdwBufferLength);
-    }
-    *lpdwBufferLength = sizeof(WSAPROTOCOL_INFOW);
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @implemented
- */
-BOOL
-EXPORT
-WSAGetOverlappedResult(IN  SOCKET s,
-                       IN  LPWSAOVERLAPPED lpOverlapped,
-                       OUT LPDWORD lpcbTransfer,
-                       IN  BOOL fWait,
-                       OUT LPDWORD lpdwFlags)
-{
-    INT Errno;
-    BOOL Success;
-    PCATALOG_ENTRY Provider;
-
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &Provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    Success = Provider->ProcTable.lpWSPGetOverlappedResult(s,
-                                                          lpOverlapped,
-                                                          lpcbTransfer,
-                                                          fWait,
-                                                          lpdwFlags,
-                                                          &Errno);
-    DereferenceProviderByPointer(Provider);
-
-    if (Success == FALSE)
-    {
-        WSASetLastError(Errno);
-    }
-
-    return Success;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-EXPORT
-WSAGetQOSByName(IN      SOCKET s,
-                IN OUT  LPWSABUF lpQOSName,
-                OUT     LPQOS lpQOS)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAHtonl(IN  SOCKET s,
-         IN  ULONG hostLONG,
-         OUT ULONG FAR* lpnetlong)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAHtons(IN  SOCKET s,
-         IN  USHORT hostshort,
-         OUT USHORT FAR* lpnetshort)
-{
-    PCATALOG_ENTRY provider;
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    switch (provider->ProtocolInfo.iNetworkByteOrder)
-    {
-    case BIGENDIAN:
-        *lpnetshort = htons(hostshort);
-        break;
-    case LITTLEENDIAN:
-#ifdef LE
-        *lpnetshort = hostshort;
-#else
-        *lpnetshort = (((hostshort & 0xFF00) >> 8) | ((hostshort & 0x00FF) << 8));
-#endif
-        break;
-    }
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-EXPORT
-WSAIsBlocking(VOID)
-{
-    UNIMPLEMENTED
-
-    return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-SOCKET
-EXPORT
-WSAJoinLeaf(IN  SOCKET s,
-            IN  CONST struct sockaddr *name,
-            IN  INT namelen,
-            IN  LPWSABUF lpCallerData,
-            OUT LPWSABUF lpCalleeData,
-            IN  LPQOS lpSQOS,
-            IN  LPQOS lpGQOS,
-            IN  DWORD dwFlags)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return INVALID_SOCKET;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSANtohl(IN  SOCKET s,
-         IN  ULONG netlong,
-         OUT ULONG FAR* lphostlong)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSANtohs(IN  SOCKET s,
-         IN  USHORT netshort,
-         OUT USHORT FAR* lphostshort)
-{
-    PCATALOG_ENTRY provider;
-    if (!WSAINITIALIZED)
-    {
-        WSASetLastError(WSANOTINITIALISED);
-        return SOCKET_ERROR;
-    }
-
-    if (!ReferenceProviderByHandle((HANDLE)s, &provider))
-    {
-        WSASetLastError(WSAENOTSOCK);
-        return SOCKET_ERROR;
-    }
-
-    switch (provider->ProtocolInfo.iNetworkByteOrder)
-    {
-    case BIGENDIAN:
-        *lphostshort = ntohs(netshort);
-        break;
-    case LITTLEENDIAN:
-#ifdef LE
-        *lphostshort = netshort;
-#else
-        *lphostshort = (((netshort & 0xFF00) >> 8) | ((netshort & 0x00FF) << 8));
-#endif
-        break;
-    }
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-FARPROC
-EXPORT
-WSASetBlockingHook(IN  FARPROC lpBlockFunc)
-{
-    UNIMPLEMENTED
-
-    return (FARPROC)0;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAUnhookBlockingHook(VOID)
-{
-    UNIMPLEMENTED
-
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSAProviderConfigChange(IN OUT  LPHANDLE lpNotificationHandle,
-                        IN      LPWSAOVERLAPPED lpOverlapped,
-                        IN      LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSACancelAsyncRequest(IN  HANDLE hAsyncTaskHandle)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-/* WinSock Service Provider support functions */
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WPUCompleteOverlappedRequest(IN  SOCKET s,
-                             IN  LPWSAOVERLAPPED lpOverlapped,
-                             IN  DWORD dwError,
-                             IN  DWORD cbTransferred,
-                             OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSCDeinstallProvider(IN  LPGUID lpProviderId,
-                     OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSCEnumProtocols(IN      LPINT lpiProtocols,
-                 OUT     LPWSAPROTOCOL_INFOW lpProtocolBuffer,
-                 IN OUT  LPDWORD lpdwBufferLength,
-                 OUT     LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSCGetProviderPath(IN      LPGUID lpProviderId,
-                   OUT     LPWSTR lpszProviderDllPath,
-                   IN OUT  LPINT lpProviderDllPathLen,
-                   OUT     LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSCInstallProvider(IN  LPGUID lpProviderId,
-                   IN  CONST WCHAR* lpszProviderDllPath,
-                   IN  CONST LPWSAPROTOCOL_INFOW lpProtocolInfoList,
-                   IN  DWORD dwNumberOfEntries,
-                   OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSCEnableNSProvider(IN  LPGUID lpProviderId,
-                    IN  BOOL fEnable)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSCInstallNameSpace(IN  LPWSTR lpszIdentifier,
-                    IN  LPWSTR lpszPathName,
-                    IN  DWORD dwNameSpace,
-                    IN  DWORD dwVersion,
-                    IN  LPGUID lpProviderId)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSCUnInstallNameSpace(IN  LPGUID lpProviderId)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSCWriteProviderOrder(IN  LPDWORD lpwdCatalogEntryId,
-                      IN  DWORD dwNumberOfEntries)
-{
-    UNIMPLEMENTED
-
-    return WSASYSCALLFAILURE;
-}
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSANSPIoctl(HANDLE           hLookup,
-            DWORD            dwControlCode,
-            LPVOID           lpvInBuffer,
-            DWORD            cbInBuffer,
-            LPVOID           lpvOutBuffer,
-            DWORD            cbOutBuffer,
-            LPDWORD          lpcbBytesReturned,
-            LPWSACOMPLETION  lpCompletion)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSCUpdateProvider(LPGUID lpProviderId,
-                  const WCHAR FAR * lpszProviderDllPath,
-                  const LPWSAPROTOCOL_INFOW lpProtocolInfoList,
-                  DWORD dwNumberOfEntries,
-                  LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-WSCWriteNameSpaceOrder(LPGUID lpProviderId,
-                       DWORD dwNumberOfEntries)
-{
-    UNIMPLEMENTED
-
-    return WSASYSCALLFAILURE;
-}
-
-/*
- * @unimplemented
- */
-INT
-EXPORT
-getnameinfo(const struct sockaddr FAR * sa,
-            socklen_t       salen,
-            char FAR *      host,
-            DWORD           hostlen,
-            char FAR *      serv,
-            DWORD           servlen,
-            INT             flags)
-{
-    if (!host && serv && flags & NI_NUMERICSERV)
-    {
-        const struct sockaddr_in *sa_in = (const struct sockaddr_in *)sa;
-        if (salen >= sizeof(*sa_in) && sa->sa_family == AF_INET)
-        {
-            StringCbPrintfA(serv, servlen, "%u", sa_in->sin_port);
-            return 0;
-        }
-    }
-
-    UNIMPLEMENTED
-
-    WSASetLastError(WSASYSCALLFAILURE);
-    return SOCKET_ERROR;
-}
-
-/*
- * @unimplemented
- */
-VOID EXPORT WEP()
-{
-    UNIMPLEMENTED
-}
-
-/*
- * @unimplemented
- */
-BOOL EXPORT WSApSetPostRoutine(PVOID Routine)
-{
-    UNIMPLEMENTED
-
-    return FALSE;
-}
-
-/* EOF */
diff --git a/dll/win32/ws2_32/misc/upcall.c b/dll/win32/ws2_32/misc/upcall.c
deleted file mode 100644 (file)
index 6ddd0ac..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS WinSock 2 DLL
- * FILE:        dll/win32/ws2_32/misc/upcall.c
- * PURPOSE:     Upcall functions
- * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
- * REVISIONS:
- *   CSH 01/09-2000 Created
- */
-
-#include "ws2_32.h"
-
-/*
- * @implemented
- */
-BOOL
-WSPAPI
-WPUCloseEvent(IN  WSAEVENT hEvent,
-              OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-WSPAPI
-WPUCloseSocketHandle(IN  SOCKET s,
-                     OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-WSPAPI
-WPUCloseThread(IN  LPWSATHREADID lpThreadId,
-               OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-WSAEVENT
-WSPAPI
-WPUCreateEvent(OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    return (WSAEVENT)0;
-}
-
-
-/*
- * @unimplemented
- */
-SOCKET
-WSPAPI
-WPUCreateSocketHandle(IN  DWORD dwCatalogEntryId,
-                      IN  DWORD_PTR dwContext,
-                      OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    return (SOCKET)0;
-}
-
-
-/*
- * @unimplemented
- */
-int
-WSPAPI
-WPUFDIsSet(IN  SOCKET s,
-           IN  LPFD_SET set)
-{
-    UNIMPLEMENTED
-
-    return (SOCKET)0;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-WSPAPI
-WPUGetProviderPath(IN      LPGUID lpProviderId,
-                   OUT     LPWSTR lpszProviderDllPath,
-                   IN OUT  LPINT lpProviderDllPathLen,
-                   OUT     LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    return 0;
-}
-
-
-/*
- * @implemented
- */
-SOCKET
-WSPAPI
-WPUModifyIFSHandle(IN  DWORD dwCatalogEntryId,
-                   IN  SOCKET ProposedHandle,
-                   OUT LPINT lpErrno)
-{
-    PCATALOG_ENTRY Provider;
-    SOCKET Socket;
-
-    WS_DbgPrint(MID_TRACE, ("dwCatalogEntryId (%d)  ProposedHandle (0x%X).\n",
-    dwCatalogEntryId, ProposedHandle));
-
-    Provider = LocateProviderById(dwCatalogEntryId);
-    if (!Provider)
-    {
-        WS_DbgPrint(MIN_TRACE, ("Provider with catalog entry id (%d) was not found.\n",
-                    dwCatalogEntryId));
-        if( lpErrno ) *lpErrno = WSAEINVAL;
-        WS_DbgPrint(MID_TRACE, ("Returning invalid socket\n"));
-        return INVALID_SOCKET;
-    }
-
-    Socket = (SOCKET)CreateProviderHandle((HANDLE)ProposedHandle,
-                                          Provider);
-
-    if( lpErrno ) *lpErrno = NO_ERROR;
-
-    WS_DbgPrint(MID_TRACE, ("Socket: %x\n", Socket));
-    return Socket;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-WSPAPI
-WPUOpenCurrentThread(OUT LPWSATHREADID lpThreadId,
-                     OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-WSPAPI
-WPUQueryBlockingCallback(IN  DWORD dwCatalogEntryId,
-                         OUT LPBLOCKINGCALLBACK FAR* lplpfnCallback,
-                         OUT PDWORD_PTR lpdwContext,
-                         OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-WSPAPI
-WPUQuerySocketHandleContext(IN  SOCKET s,
-                            OUT PDWORD_PTR lpContext,
-                            OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-INT
-WSPAPI
-WPUQueueApc(IN  LPWSATHREADID lpThreadId,
-            IN  LPWSAUSERAPC lpfnUserApc,
-            IN  DWORD_PTR dwContext,
-            OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WSPAPI
-WPUResetEvent(IN  WSAEVENT hEvent,
-              OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    return FALSE;
-}
-
-
-/*
- * @unimplemented
- */
-BOOL
-WSPAPI
-WPUSetEvent(IN  WSAEVENT hEvent,
-            OUT LPINT lpErrno)
-{
-    UNIMPLEMENTED
-
-    return FALSE;
-}
-
-/* EOF */
diff --git a/dll/win32/ws2_32/tests/setup.c b/dll/win32/ws2_32/tests/setup.c
deleted file mode 100644 (file)
index 9a715f6..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <windows.h>
-#include "regtests.h"
-
-extern BOOL
-WINAPI
-DllMain(HANDLE hInstDll,
-        ULONG dwReason,
-        LPVOID lpReserved);
-
-_SetupOnce()
-{
-  DllMain(NULL, DLL_PROCESS_ATTACH, NULL);
-}
diff --git a/dll/win32/ws2_32/tests/stubs.tst b/dll/win32/ws2_32/tests/stubs.tst
deleted file mode 100644 (file)
index d94069d..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-kernel32.dll  CreateEventW@16
-kernel32.dll  InitializeCriticalSection@4
-kernel32.dll  DeleteCriticalSection@4
-kernel32.dll  EnterCriticalSection@4
-kernel32.dll  ExitProcess@4
-kernel32.dll  FreeLibrary@4
-kernel32.dll  GetLastError@0
-kernel32.dll  GetProcAddress@8
-kernel32.dll  GetProcessHeap@0
-ntdll.dll  HeapAlloc@12=RtlAllocateHeap
-ntdll.dll  HeapFree@12=RtlFreeHeap
-kernel32.dll  LeaveCriticalSection@4
-kernel32.dll  LoadLibraryW@4
-kernel32.dll  lstrcpyA@8
-ntdll.dll  ResetEvent@4
-ntdll.dll  SetEvent@4
-kernel32.dll  Sleep@4
-ntdll.dll  WaitForMultipleObjectsEx@20
-kernel32.dll  CloseHandle@4
diff --git a/dll/win32/ws2_32/tests/tests/WinsockEvent.c b/dll/win32/ws2_32/tests/tests/WinsockEvent.c
deleted file mode 100644 (file)
index 63bad75..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#include <windows.h>
-#include <winsock2.h>
-#include "regtests.h"
-
-#define TestHandle (HANDLE) 1
-
-static BOOL CloseHandleSuccessCalled = FALSE;
-
-static BOOL WINAPI
-MockCloseHandleSuccess(HANDLE hObject)
-{
-  CloseHandleSuccessCalled = TRUE;
-  _AssertEqualValue(TestHandle, hObject);
-  return TRUE;
-}
-
-static HOOK HooksSuccess[] =
-{
-  {"CloseHandle", MockCloseHandleSuccess},
-  {NULL, NULL}
-};
-
-static void
-TestWSACloseEventSuccess()
-{
-  BOOL result;
-
-  _SetHooks(HooksSuccess);
-  result = WSACloseEvent(TestHandle);
-  _AssertTrue(result);
-  _AssertEqualValue(NO_ERROR, WSAGetLastError());
-  _AssertTrue(CloseHandleSuccessCalled);
-  _UnsetAllHooks();
-}
-
-
-static BOOL CloseHandleFailureCalled = FALSE;
-
-static BOOL WINAPI
-MockCloseHandleFailure(HANDLE hObject)
-{
-  CloseHandleFailureCalled = TRUE;
-  return FALSE;
-}
-
-static HOOK HooksFailure[] =
-{
-  {"CloseHandle", MockCloseHandleFailure},
-  {NULL, NULL}
-};
-
-static void
-TestWSACloseEventFailure()
-{
-  BOOL result;
-
-  _SetHooks(HooksFailure);
-  result = WSACloseEvent(TestHandle);
-  _AssertFalse(result);
-  _AssertEqualValue(WSA_INVALID_HANDLE, WSAGetLastError());
-  _AssertTrue(CloseHandleFailureCalled);
-  _UnsetAllHooks();
-}
-
-
-static void
-TestWSACloseEvent()
-{
-  TestWSACloseEventSuccess();
-  TestWSACloseEventFailure();
-}
-
-static void
-RunTest()
-{
-  WSADATA WSAData;
-
-  WSAStartup(MAKEWORD(2, 0), &WSAData);
-  TestWSACloseEvent();
-  WSACleanup();
-}
-
-_Dispatcher(WinsockeventTest, "Winsock 2 event")
diff --git a/dll/win32/ws2_32/wine/async.c b/dll/win32/ws2_32/wine/async.c
deleted file mode 100644 (file)
index 40fa635..0000000
+++ /dev/null
@@ -1,440 +0,0 @@
-/* Async WINSOCK DNS services
- *
- * Copyright (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka.
- * Copyright (C) 1999 Marcus Meissner
- * Copyright (C) 2009 Alexandre Julliard
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- *
- * NOTE: If you make any changes to fix a particular app, make sure
- * they don't break something else like Netscape or telnet and ftp
- * clients and servers (www.winsite.com got a lot of those).
- *
- * FIXME:
- *     - Add WSACancel* and correct handle management. (works rather well for
- *       now without it.)
- *     - Verify & Check all calls for correctness
- *       (currently only WSAGetHostByName*, WSAGetServByPort* calls)
- *     - Check error returns.
- *     - mirc/mirc32 Finger @linux.kernel.org sometimes fails in threaded mode.
- *       (not sure why)
- *     - This implementation did ignore the "NOTE:" section above (since the
- *       whole stuff did not work anyway to other changes).
- */
-
-#define WIN32_NO_STATUS
-#define _INC_WINDOWS
-#define COM_NO_WINDOWS_H
-
-#include <wine/config.h>
-
-#include <stdarg.h>
-#include <windef.h>
-#include <winbase.h>
-#include <winuser.h>
-#include <winsock2.h>
-
-#include <wine/debug.h>
-
-WINE_DEFAULT_DEBUG_CHANNEL(winsock);
-
-
-struct async_query_header
-{
-    HWND   hWnd;
-    UINT   uMsg;
-    void  *sbuf;
-    INT    sbuflen;
-    HANDLE handle;
-};
-
-struct async_query_gethostbyname
-{
-    struct async_query_header query;
-    char *host_name;
-};
-
-struct async_query_gethostbyaddr
-{
-    struct async_query_header query;
-    char *host_addr;
-    int   host_len;
-    int   host_type;
-};
-
-struct async_query_getprotobyname
-{
-    struct async_query_header query;
-    char *proto_name;
-};
-
-struct async_query_getprotobynumber
-{
-    struct async_query_header query;
-    int   proto_number;
-};
-
-struct async_query_getservbyname
-{
-    struct async_query_header query;
-    char *serv_name;
-    char *serv_proto;
-};
-
-struct async_query_getservbyport
-{
-    struct async_query_header query;
-    char *serv_proto;
-    int   serv_port;
-};
-
-
-/* ----------------------------------- helper functions - */
-
-static int list_size(char** l, int item_size)
-{
-  int i,j = 0;
-  if(l)
-  { for(i=0;l[i];i++)
-       j += (item_size) ? item_size : strlen(l[i]) + 1;
-    j += (i + 1) * sizeof(char*); }
-  return j;
-}
-
-static int list_dup(char** l_src, char* ref, int item_size)
-{
-   char*               p = ref;
-   char**              l_to = (char**)ref;
-   int                 i,j,k;
-
-   for(j=0;l_src[j];j++) ;
-   p += (j + 1) * sizeof(char*);
-   for(i=0;i<j;i++)
-   { l_to[i] = p;
-     k = ( item_size ) ? item_size : strlen(l_src[i]) + 1;
-     memcpy(p, l_src[i], k); p += k; }
-   l_to[i] = NULL;
-   return (p - ref);
-}
-
-static DWORD finish_query( struct async_query_header *query, LPARAM lparam )
-{
-    PostMessageW( query->hWnd, query->uMsg, (WPARAM)query->handle, lparam );
-    HeapFree( GetProcessHeap(), 0, query );
-    return 0;
-}
-
-/* ----- hostent */
-
-static LPARAM copy_he(void *base, int size, const struct hostent *he)
-{
-    char *p;
-    int needed;
-    struct hostent *to = base;
-
-    if (!he) return MAKELPARAM( 0, GetLastError() );
-
-    needed = sizeof(struct hostent) + strlen(he->h_name) + 1 +
-                 list_size(he->h_aliases, 0) +
-                 list_size(he->h_addr_list, he->h_length );
-    if (size < needed) return MAKELPARAM( needed, WSAENOBUFS );
-
-    to->h_addrtype = he->h_addrtype;
-    to->h_length = he->h_length;
-    p = (char *)(to + 1);
-    to->h_name = p;
-    strcpy(p, he->h_name); p += strlen(p) + 1;
-    to->h_aliases = (char **)p;
-    p += list_dup(he->h_aliases, p, 0);
-    to->h_addr_list = (char **)p;
-    list_dup(he->h_addr_list, p, he->h_length);
-    return MAKELPARAM( needed, 0 );
-}
-
-static DWORD WINAPI async_gethostbyname(LPVOID arg)
-{
-    struct async_query_gethostbyname *aq = arg;
-    struct hostent *he = gethostbyname( aq->host_name );
-
-    return finish_query( &aq->query, copy_he( aq->query.sbuf, aq->query.sbuflen, he ));
-}
-
-static DWORD WINAPI async_gethostbyaddr(LPVOID arg)
-{
-    struct async_query_gethostbyaddr *aq = arg;
-    struct hostent *he = gethostbyaddr( aq->host_addr, aq->host_len, aq->host_type );
-
-    return finish_query( &aq->query, copy_he( aq->query.sbuf, aq->query.sbuflen, he ));
-}
-
-/* ----- protoent */
-
-static LPARAM copy_pe(void *base, int size, const struct protoent* pe)
-{
-    char *p;
-    int needed;
-    struct protoent *to = base;
-
-    if (!pe) return MAKELPARAM( 0, GetLastError() );
-
-    needed = sizeof(struct protoent) + strlen(pe->p_name) + 1 + list_size(pe->p_aliases, 0);
-    if (size < needed) return MAKELPARAM( needed, WSAENOBUFS );
-
-    to->p_proto = pe->p_proto;
-    p = (char *)(to + 1);
-    to->p_name = p;
-    strcpy(p, pe->p_name); p += strlen(p) + 1;
-    to->p_aliases = (char **)p;
-    list_dup(pe->p_aliases, p, 0);
-    return MAKELPARAM( needed, 0 );
-}
-
-static DWORD WINAPI async_getprotobyname(LPVOID arg)
-{
-    struct async_query_getprotobyname *aq = arg;
-    struct protoent *pe = getprotobyname( aq->proto_name );
-
-    return finish_query( &aq->query, copy_pe( aq->query.sbuf, aq->query.sbuflen, pe ));
-}
-
-static DWORD WINAPI async_getprotobynumber(LPVOID arg)
-{
-    struct async_query_getprotobynumber *aq = arg;
-    struct protoent *pe = getprotobynumber( aq->proto_number );
-
-    return finish_query( &aq->query, copy_pe( aq->query.sbuf, aq->query.sbuflen, pe ));
-}
-
-/* ----- servent */
-
-static LPARAM copy_se(void *base, int size, const struct servent* se)
-{
-    char *p;
-    int needed;
-    struct servent *to = base;
-
-    if (!se) return MAKELPARAM( 0, GetLastError() );
-
-    needed = sizeof(struct servent) + strlen(se->s_proto) + strlen(se->s_name) + 2 + list_size(se->s_aliases, 0);
-    if (size < needed) return MAKELPARAM( needed, WSAENOBUFS );
-
-    to->s_port = se->s_port;
-    p = (char *)(to + 1);
-    to->s_name = p;
-    strcpy(p, se->s_name); p += strlen(p) + 1;
-    to->s_proto = p;
-    strcpy(p, se->s_proto); p += strlen(p) + 1;
-    to->s_aliases = (char **)p;
-    list_dup(se->s_aliases, p, 0);
-    return MAKELPARAM( needed, 0 );
-}
-
-static DWORD WINAPI async_getservbyname(LPVOID arg)
-{
-    struct async_query_getservbyname *aq = arg;
-    struct servent *se = getservbyname( aq->serv_name, aq->serv_proto );
-
-    return finish_query( &aq->query, copy_se( aq->query.sbuf, aq->query.sbuflen, se ));
-}
-
-static DWORD WINAPI async_getservbyport(LPVOID arg)
-{
-    struct async_query_getservbyport *aq = arg;
-    struct servent *se = getservbyport( aq->serv_port, aq->serv_proto );
-
-    return finish_query( &aq->query, copy_se( aq->query.sbuf, aq->query.sbuflen, se ));
-}
-
-
-/****************************************************************************
- * The main async help function.
- *
- * It either starts a thread or just calls the function directly for platforms
- * with no thread support. This relies on the fact that PostMessage() does
- * not actually call the windowproc before the function returns.
- */
-static HANDLE run_query( HWND hWnd, UINT uMsg, LPTHREAD_START_ROUTINE func,
-                         struct async_query_header *query, void *sbuf, INT sbuflen )
-{
-    static LONG next_handle = 0xdead;
-    HANDLE thread;
-    ULONG handle;
-    do
-        handle = LOWORD( InterlockedIncrement( &next_handle ));
-    while (!handle); /* avoid handle 0 */
-
-    query->hWnd    = hWnd;
-    query->uMsg    = uMsg;
-    query->handle  = UlongToHandle( handle );
-    query->sbuf    = sbuf;
-    query->sbuflen = sbuflen;
-
-    thread = CreateThread( NULL, 0, func, query, 0, NULL );
-    if (!thread)
-    {
-        SetLastError( WSAEWOULDBLOCK );
-        HeapFree( GetProcessHeap(), 0, query );
-        return 0;
-    }
-    CloseHandle( thread );
-    return UlongToHandle( handle );
-}
-
-
-/***********************************************************************
- *       WSAAsyncGetHostByAddr        (WS2_32.102)
- */
-HANDLE WINAPI WSAAsyncGetHostByAddr(HWND hWnd, UINT uMsg, LPCSTR addr,
-                               INT len, INT type, LPSTR sbuf, INT buflen)
-{
-    struct async_query_gethostbyaddr *aq;
-
-    TRACE("hwnd %p, msg %04x, addr %p[%i]\n", hWnd, uMsg, addr, len );
-
-    if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len )))
-    {
-        SetLastError( WSAEWOULDBLOCK );
-        return 0;
-    }
-    aq->host_addr = (char *)(aq + 1);
-    aq->host_len  = len;
-    aq->host_type = type;
-    memcpy( aq->host_addr, addr, len );
-    return run_query( hWnd, uMsg, async_gethostbyaddr, &aq->query, sbuf, buflen );
-}
-
-/***********************************************************************
- *       WSAAsyncGetHostByName (WS2_32.103)
- */
-HANDLE WINAPI WSAAsyncGetHostByName(HWND hWnd, UINT uMsg, LPCSTR name,
-                                       LPSTR sbuf, INT buflen)
-{
-    struct async_query_gethostbyname *aq;
-    unsigned int len = strlen(name) + 1;
-
-    TRACE("hwnd %p, msg %04x, host %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen );
-
-    if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len )))
-    {
-        SetLastError( WSAEWOULDBLOCK );
-        return 0;
-    }
-    aq->host_name = (char *)(aq + 1);
-    strcpy( aq->host_name, name );
-    return run_query( hWnd, uMsg, async_gethostbyname, &aq->query, sbuf, buflen );
-}
-
-/***********************************************************************
- *       WSAAsyncGetProtoByName       (WS2_32.105)
- */
-HANDLE WINAPI WSAAsyncGetProtoByName(HWND hWnd, UINT uMsg, LPCSTR name,
-                                         LPSTR sbuf, INT buflen)
-{
-    struct async_query_getprotobyname *aq;
-    unsigned int len = strlen(name) + 1;
-
-    TRACE("hwnd %p, msg %04x, proto %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen );
-
-    if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len )))
-    {
-        SetLastError( WSAEWOULDBLOCK );
-        return 0;
-    }
-    aq->proto_name = (char *)(aq + 1);
-    strcpy( aq->proto_name, name );
-    return run_query( hWnd, uMsg, async_getprotobyname, &aq->query, sbuf, buflen );
-}
-
-
-/***********************************************************************
- *       WSAAsyncGetProtoByNumber     (WS2_32.104)
- */
-HANDLE WINAPI WSAAsyncGetProtoByNumber(HWND hWnd, UINT uMsg, INT number,
-                                           LPSTR sbuf, INT buflen)
-{
-    struct async_query_getprotobynumber *aq;
-
-    TRACE("hwnd %p, msg %04x, num %i\n", hWnd, uMsg, number );
-
-    if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) )))
-    {
-        SetLastError( WSAEWOULDBLOCK );
-        return 0;
-    }
-    aq->proto_number = number;
-    return run_query( hWnd, uMsg, async_getprotobynumber, &aq->query, sbuf, buflen );
-}
-
-/***********************************************************************
- *       WSAAsyncGetServByName        (WS2_32.107)
- */
-HANDLE WINAPI WSAAsyncGetServByName(HWND hWnd, UINT uMsg, LPCSTR name,
-                                        LPCSTR proto, LPSTR sbuf, INT buflen)
-{
-    struct async_query_getservbyname *aq;
-    unsigned int len1 = strlen(name) + 1;
-    unsigned int len2 = proto ? strlen(proto) + 1 : 0;
-
-    TRACE("hwnd %p, msg %04x, name %s, proto %s\n", hWnd, uMsg, debugstr_a(name), debugstr_a(proto));
-
-    if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len1 + len2 )))
-    {
-        SetLastError( WSAEWOULDBLOCK );
-        return 0;
-    }
-
-    aq->serv_name  = (char *)(aq + 1);
-    strcpy( aq->serv_name, name );
-
-    if (proto)
-    {
-        aq->serv_proto = aq->serv_name + len1;
-        strcpy( aq->serv_proto, proto );
-    }
-    else
-        aq->serv_proto = NULL;
-
-    return run_query( hWnd, uMsg, async_getservbyname, &aq->query, sbuf, buflen );
-}
-
-/***********************************************************************
- *       WSAAsyncGetServByPort        (WS2_32.106)
- */
-HANDLE WINAPI WSAAsyncGetServByPort(HWND hWnd, UINT uMsg, INT port,
-                                        LPCSTR proto, LPSTR sbuf, INT buflen)
-{
-    struct async_query_getservbyport *aq;
-    unsigned int len = proto ? strlen(proto) + 1 : 0;
-
-    TRACE("hwnd %p, msg %04x, port %i, proto %s\n", hWnd, uMsg, port, debugstr_a(proto));
-
-    if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len )))
-    {
-        SetLastError( WSAEWOULDBLOCK );
-        return 0;
-    }
-
-    if (proto)
-    {
-        aq->serv_proto = (char *)(aq + 1);
-        strcpy( aq->serv_proto, proto );
-    }
-    else
-        aq->serv_proto = NULL;
-
-    aq->serv_port = port;
-
-    return run_query( hWnd, uMsg, async_getservbyport, &aq->query, sbuf, buflen );
-}
diff --git a/dll/win32/ws2_32/wine/socket.c b/dll/win32/ws2_32/wine/socket.c
deleted file mode 100644 (file)
index eb097a8..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * based on Windows Sockets 1.1 specs
- *
- * Copyright (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka.
- * Copyright (C) 2001 Stefan Leichter
- * Copyright (C) 2004 Hans Leidekker
- * Copyright (C) 2005 Marcus Meissner
- * Copyright (C) 2006-2008 Kai Blin
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- *
- * NOTE: If you make any changes to fix a particular app, make sure
- * they don't break something else like Netscape or telnet and ftp
- * clients and servers (www.winsite.com got a lot of those).
- */
-
-#define WIN32_NO_STATUS
-#define _INC_WINDOWS
-#define COM_NO_WINDOWS_H
-#include <windef.h>
-#include <winbase.h>
-#include <winnls.h>
-#include <ws2tcpip.h>
-
-static inline void FreeAddrInfoW_(struct addrinfoW *pAddrInfo)
-{
-    freeaddrinfo((struct addrinfo *)pAddrInfo);
-}
-#define FreeAddrInfoW FreeAddrInfoW_
-
-static struct addrinfoW *addrinfo_AtoW(const struct addrinfo *ai)
-{
-    struct addrinfoW *ret;
-
-    if (!(ret = HeapAlloc(GetProcessHeap(), 0, sizeof(struct addrinfoW)))) return NULL;
-    ret->ai_flags     = ai->ai_flags;
-    ret->ai_family    = ai->ai_family;
-    ret->ai_socktype  = ai->ai_socktype;
-    ret->ai_protocol  = ai->ai_protocol;
-    ret->ai_addrlen   = ai->ai_addrlen;
-    ret->ai_canonname = NULL;
-    ret->ai_addr      = NULL;
-    ret->ai_next      = NULL;
-    if (ai->ai_canonname)
-    {
-        int len = MultiByteToWideChar(CP_ACP, 0, ai->ai_canonname, -1, NULL, 0);
-        if (!(ret->ai_canonname = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR))))
-        {
-            HeapFree(GetProcessHeap(), 0, ret);
-            return NULL;
-        }
-        MultiByteToWideChar(CP_ACP, 0, ai->ai_canonname, -1, ret->ai_canonname, len);
-    }
-    if (ai->ai_addr)
-    {
-        if (!(ret->ai_addr = HeapAlloc(GetProcessHeap(), 0, ai->ai_addrlen)))
-        {
-            HeapFree(GetProcessHeap(), 0, ret->ai_canonname);
-            HeapFree(GetProcessHeap(), 0, ret);
-            return NULL;
-        }
-        memcpy(ret->ai_addr, ai->ai_addr, ai->ai_addrlen);
-    }
-    return ret;
-}
-
-static struct addrinfoW *addrinfo_list_AtoW(const struct addrinfo *info)
-{
-    struct addrinfoW *ret, *infoW;
-
-    if (!(ret = infoW = addrinfo_AtoW(info))) return NULL;
-    while (info->ai_next)
-    {
-        if (!(infoW->ai_next = addrinfo_AtoW(info->ai_next)))
-        {
-            FreeAddrInfoW(ret);
-            return NULL;
-        }
-        infoW = infoW->ai_next;
-        info = info->ai_next;
-    }
-    return ret;
-}
-
-static struct addrinfo *addrinfo_WtoA(const struct addrinfoW *ai)
-{
-    struct addrinfo *ret;
-
-    if (!(ret = HeapAlloc(GetProcessHeap(), 0, sizeof(struct addrinfo)))) return NULL;
-    ret->ai_flags     = ai->ai_flags;
-    ret->ai_family    = ai->ai_family;
-    ret->ai_socktype  = ai->ai_socktype;
-    ret->ai_protocol  = ai->ai_protocol;
-    ret->ai_addrlen   = ai->ai_addrlen;
-    ret->ai_canonname = NULL;
-    ret->ai_addr      = NULL;
-    ret->ai_next      = NULL;
-    if (ai->ai_canonname)
-    {
-        int len = WideCharToMultiByte(CP_ACP, 0, ai->ai_canonname, -1, NULL, 0, NULL, NULL);
-        if (!(ret->ai_canonname = HeapAlloc(GetProcessHeap(), 0, len)))
-        {
-            HeapFree(GetProcessHeap(), 0, ret);
-            return NULL;
-        }
-        WideCharToMultiByte(CP_ACP, 0, ai->ai_canonname, -1, ret->ai_canonname, len, NULL, NULL);
-    }
-    if (ai->ai_addr)
-    {
-        if (!(ret->ai_addr = HeapAlloc(GetProcessHeap(), 0, sizeof(struct sockaddr))))
-        {
-            HeapFree(GetProcessHeap(), 0, ret->ai_canonname);
-            HeapFree(GetProcessHeap(), 0, ret);
-            return NULL;
-        }
-        memcpy(ret->ai_addr, ai->ai_addr, sizeof(struct sockaddr));
-    }
-    return ret;
-}
-
-/***********************************************************************
- *             GetAddrInfoW            (WS2_32.@)
- */
-int WINAPI GetAddrInfoW(LPCWSTR nodename, LPCWSTR servname, const ADDRINFOW *hints, PADDRINFOW *res)
-{
-    int ret, len;
-    char *nodenameA = NULL, *servnameA = NULL;
-    struct addrinfo *resA, *hintsA = NULL;
-
-    *res = NULL;
-    if (nodename)
-    {
-        len = WideCharToMultiByte(CP_ACP, 0, nodename, -1, NULL, 0, NULL, NULL);
-        if (!(nodenameA = HeapAlloc(GetProcessHeap(), 0, len))) return EAI_MEMORY;
-        WideCharToMultiByte(CP_ACP, 0, nodename, -1, nodenameA, len, NULL, NULL);
-    }
-    if (servname)
-    {
-        len = WideCharToMultiByte(CP_ACP, 0, servname, -1, NULL, 0, NULL, NULL);
-        if (!(servnameA = HeapAlloc(GetProcessHeap(), 0, len)))
-        {
-            HeapFree(GetProcessHeap(), 0, nodenameA);
-            return EAI_MEMORY;
-        }
-        WideCharToMultiByte(CP_ACP, 0, servname, -1, servnameA, len, NULL, NULL);
-    }
-
-    if (hints) hintsA = addrinfo_WtoA(hints);
-    ret = getaddrinfo(nodenameA, servnameA, hintsA, &resA);
-    freeaddrinfo(hintsA);
-
-    if (!ret)
-    {
-        *res = addrinfo_list_AtoW(resA);
-        freeaddrinfo(resA);
-    }
-
-    HeapFree(GetProcessHeap(), 0, nodenameA);
-    HeapFree(GetProcessHeap(), 0, servnameA);
-    return ret;
-}
-
-int WINAPI GetNameInfoW(const SOCKADDR *sa, socklen_t salen, PWCHAR host,
-                        DWORD hostlen, PWCHAR serv, DWORD servlen, INT flags)
-{
-    int ret;
-    char *hostA = NULL, *servA = NULL;
-
-    if (host && (!(hostA = HeapAlloc(GetProcessHeap(), 0, hostlen)))) return EAI_MEMORY;
-    if (serv && (!(servA = HeapAlloc(GetProcessHeap(), 0, servlen))))
-    {
-        HeapFree(GetProcessHeap(), 0, hostA);
-        return EAI_MEMORY;
-    }
-
-    ret = getnameinfo(sa, salen, hostA, hostlen, servA, servlen, flags);
-    if (!ret)
-    {
-        if (host) MultiByteToWideChar(CP_ACP, 0, hostA, -1, host, hostlen);
-        if (serv) MultiByteToWideChar(CP_ACP, 0, servA, -1, serv, servlen);
-    }
-
-    HeapFree(GetProcessHeap(), 0, hostA);
-    HeapFree(GetProcessHeap(), 0, servA);
-    return ret;
-}
diff --git a/drivers/base/kdcom/arm/kdbg.c b/drivers/base/kdcom/arm/kdbg.c
deleted file mode 100644 (file)
index 1768d03..0000000
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * PROJECT:         ReactOS Kernel
- * LICENSE:         BSD - See COPYING.ARM in the top level directory
- * FILE:            drivers/base/kdcom/arm/kdbg.c
- * PURPOSE:         Serial Port Kernel Debugging Transport Library
- * PROGRAMMERS:     ReactOS Portable Systems Group
- */
-
-/* INCLUDES *******************************************************************/
-
-#define NOEXTAPI
-#include <ntifs.h>
-#define NDEBUG
-#include <halfuncs.h>
-#include <stdio.h>
-#include <debug.h>
-#include "arc/arc.h"
-#include "windbgkd.h"
-#include <kddll.h>
-#include <ioaccess.h>
-#include <arm/peripherals/pl011.h>
-
-/* GLOBALS ********************************************************************/
-
-typedef struct _KD_PORT_INFORMATION
-{
-    ULONG ComPort;
-    ULONG BaudRate;
-    ULONG BaseAddress;
-} KD_PORT_INFORMATION, *PKD_PORT_INFORMATION;
-
-KD_PORT_INFORMATION DefaultPort = {0, 0, 0};
-
-//
-// We need to build this in the configuration root and use KeFindConfigurationEntry
-// to recover it later.
-//
-#define HACK 24000000
-
-/* REACTOS FUNCTIONS **********************************************************/
-
-BOOLEAN
-NTAPI
-KdPortInitializeEx(IN PKD_PORT_INFORMATION PortInformation,
-                   IN ULONG Unknown1,
-                   IN ULONG Unknown2)
-{
-    ULONG Divider, Remainder, Fraction;
-    ULONG Baudrate = PortInformation->BaudRate;
-    
-    //
-    // Calculate baudrate clock divider and remainder
-    //
-    Divider   = HACK / (16 * Baudrate);
-    Remainder = HACK % (16 * Baudrate);
-    
-    //
-    // Calculate the fractional part
-    //
-    Fraction  = (8 * Remainder / Baudrate) >> 1;
-    Fraction += (8 * Remainder / Baudrate) & 1;
-    
-    //
-    // Disable interrupts
-    //
-    WRITE_REGISTER_ULONG(UART_PL011_CR, 0);
-    
-    //
-    // Set the baud rate
-    //
-    WRITE_REGISTER_ULONG(UART_PL011_IBRD, Divider);
-    WRITE_REGISTER_ULONG(UART_PL011_FBRD, Fraction);
-    
-    //
-    // Set 8 bits for data, 1 stop bit, no parity, FIFO enabled
-    //
-    WRITE_REGISTER_ULONG(UART_PL011_LCRH,
-                         UART_PL011_LCRH_WLEN_8 | UART_PL011_LCRH_FEN);
-    
-    //
-    // Clear and enable FIFO
-    //
-    WRITE_REGISTER_ULONG(UART_PL011_CR,
-                         UART_PL011_CR_UARTEN |
-                         UART_PL011_CR_TXE |
-                         UART_PL011_CR_RXE);
-    
-    //
-    // Done
-    //
-    return TRUE;
-}
-
-BOOLEAN
-NTAPI
-KdPortInitialize(IN PKD_PORT_INFORMATION PortInformation,
-                 IN ULONG Unknown1,
-                 IN ULONG Unknown2)
-{
-    //
-    // Call the extended version
-    //
-    return KdPortInitializeEx(PortInformation, Unknown1, Unknown2);
-}
-
-BOOLEAN
-NTAPI
-KdPortGetByteEx(IN PKD_PORT_INFORMATION PortInformation,
-                OUT PUCHAR ByteReceived)
-{
-    UNIMPLEMENTED;
-    while (TRUE);
-    return FALSE;
-}
-
-BOOLEAN
-NTAPI
-KdPortGetByte(OUT PUCHAR ByteReceived)
-{
-    //
-    // Call the extended version
-    //
-    return KdPortGetByteEx(&DefaultPort, ByteReceived); 
-}
-
-BOOLEAN
-NTAPI
-KdPortPollByteEx(IN PKD_PORT_INFORMATION PortInformation,
-                 OUT PUCHAR ByteReceived)
-{
-    UNIMPLEMENTED;
-    while (TRUE);
-    return TRUE;
-}
-
-BOOLEAN
-NTAPI
-KdPortPollByte(OUT PUCHAR ByteReceived)
-{
-    //
-    // Call the extended version
-    //
-    return KdPortPollByteEx(&DefaultPort, ByteReceived);
-}
-
-VOID
-NTAPI
-KdPortPutByteEx(IN PKD_PORT_INFORMATION PortInformation,
-                IN UCHAR ByteToSend)
-{
-    //
-    // Wait for ready
-    //
-    while ((READ_REGISTER_ULONG(UART_PL01x_FR) & UART_PL01x_FR_TXFF) != 0);
-    
-    //
-    // Send the character
-    //
-    WRITE_REGISTER_ULONG(UART_PL01x_DR, ByteToSend);
-}
-
-VOID
-NTAPI
-KdPortPutByte(IN UCHAR ByteToSend)
-{
-    //
-    // Call the extended version
-    //
-    KdPortPutByteEx(&DefaultPort, ByteToSend);
-}
-
-VOID
-NTAPI
-KdPortRestore(VOID)
-{
-    UNIMPLEMENTED;
-    while (TRUE);
-}
-
-VOID
-NTAPI
-KdPortSave(VOID)
-{
-    UNIMPLEMENTED;
-    while (TRUE);
-}
-
-BOOLEAN
-NTAPI
-KdPortDisableInterrupts(VOID)
-{
-    UNIMPLEMENTED;
-    while (TRUE);
-    return TRUE;
-}
-
-BOOLEAN
-NTAPI
-KdPortEnableInterrupts(VOID)
-{
-    UNIMPLEMENTED;
-    while (TRUE);
-    return TRUE;
-}
-
-/* WINDOWS FUNCTIONS **********************************************************/
-
-NTSTATUS
-NTAPI
-KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
-{
-    UNIMPLEMENTED;
-    return STATUS_NOT_IMPLEMENTED;
-}
-
-NTSTATUS
-NTAPI
-KdDebuggerInitialize1(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
-{
-    UNIMPLEMENTED;
-    return STATUS_NOT_IMPLEMENTED;
-}
-
-NTSTATUS
-NTAPI
-KdSave(IN BOOLEAN SleepTransition)
-{
-    UNIMPLEMENTED;
-    while (TRUE);
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS
-NTAPI
-KdRestore(IN BOOLEAN SleepTransition)
-{
-    UNIMPLEMENTED;
-    while (TRUE);
-    return STATUS_SUCCESS;
-}
-
-VOID
-NTAPI
-KdSendPacket(IN ULONG PacketType,
-             IN PSTRING MessageHeader,
-             IN PSTRING MessageData,
-             IN OUT PKD_CONTEXT Context)
-{
-    UNIMPLEMENTED;
-    while (TRUE);
-    return;
-}
-
-KDSTATUS
-NTAPI
-KdReceivePacket(IN ULONG PacketType,
-                OUT PSTRING MessageHeader,
-                OUT PSTRING MessageData,
-                OUT PULONG DataLength,
-                IN OUT PKD_CONTEXT Context)
-{
-    UNIMPLEMENTED;
-    while (TRUE);
-    return 0;
-}
-
-/* EOF */
diff --git a/drivers/base/kdcom/i386/kdbg.c b/drivers/base/kdcom/i386/kdbg.c
deleted file mode 100644 (file)
index 45a736d..0000000
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS kernel
- * FILE:            drivers/base/kdcom/kdbg.c
- * PURPOSE:         Serial i/o functions for the kernel debugger.
- * PROGRAMMER:      Alex Ionescu
- *                  Hervé Poussineau
- */
-
-/* INCLUDES *****************************************************************/
-
-#define NOEXTAPI
-#include <ntifs.h>
-#include <halfuncs.h>
-#include <stdio.h>
-#include "arc/arc.h"
-#include "windbgkd.h"
-#include <kddll.h>
-#include <ioaccess.h> /* port intrinsics */
-#include <cportlib/cportlib.h>
-
-#define NDEBUG
-#include <debug.h>
-
-
-typedef struct _KD_PORT_INFORMATION
-{
-    ULONG ComPort;
-    ULONG BaudRate;
-    ULONG BaseAddress;
-} KD_PORT_INFORMATION, *PKD_PORT_INFORMATION;
-
-BOOLEAN
-NTAPI
-KdPortInitializeEx(
-    IN PKD_PORT_INFORMATION PortInformation,
-    IN ULONG Unknown1,
-    IN ULONG Unknown2);
-
-BOOLEAN
-NTAPI
-KdPortGetByteEx(
-    IN PKD_PORT_INFORMATION PortInformation,
-    OUT PUCHAR ByteReceived);
-
-BOOLEAN
-NTAPI
-KdPortPollByteEx(
-    IN PKD_PORT_INFORMATION PortInformation,
-    OUT PUCHAR ByteReceived);
-
-VOID
-NTAPI
-KdPortPutByteEx(
-    IN PKD_PORT_INFORMATION PortInformation,
-    IN UCHAR ByteToSend);
-
-#define DEFAULT_BAUD_RATE    19200
-
-#if defined(_M_IX86) || defined(_M_AMD64)
-const ULONG BaseArray[] = {0, 0x3F8, 0x2F8, 0x3E8, 0x2E8};
-#elif defined(_M_PPC)
-const ULONG BaseArray[] = {0, 0x800003F8};
-#elif defined(_M_MIPS)
-const ULONG BaseArray[] = {0, 0x80006000, 0x80007000};
-#elif defined(_M_ARM)
-const ULONG BaseArray[] = {0, 0xF1012000};
-#else
-#error Unknown architecture
-#endif
-
-/* MACROS *******************************************************************/
-
-#define   SER_RBR(x)   ((PUCHAR)(x)+0)
-#define   SER_THR(x)   ((PUCHAR)(x)+0)
-#define   SER_DLL(x)   ((PUCHAR)(x)+0)
-#define   SER_IER(x)   ((PUCHAR)(x)+1)
-#define     SR_IER_ERDA   0x01
-#define     SR_IER_ETHRE  0x02
-#define     SR_IER_ERLSI  0x04
-#define     SR_IER_EMS    0x08
-#define     SR_IER_ALL    0x0F
-#define   SER_DLM(x)   ((PUCHAR)(x)+1)
-#define   SER_IIR(x)   ((PUCHAR)(x)+2)
-#define   SER_FCR(x)   ((PUCHAR)(x)+2)
-#define     SR_FCR_ENABLE_FIFO 0x01
-#define     SR_FCR_CLEAR_RCVR  0x02
-#define     SR_FCR_CLEAR_XMIT  0x04
-#define   SER_LCR(x)   ((PUCHAR)(x)+3)
-#define     SR_LCR_CS5 0x00
-#define     SR_LCR_CS6 0x01
-#define     SR_LCR_CS7 0x02
-#define     SR_LCR_CS8 0x03
-#define     SR_LCR_ST1 0x00
-#define     SR_LCR_ST2 0x04
-#define     SR_LCR_PNO 0x00
-#define     SR_LCR_POD 0x08
-#define     SR_LCR_PEV 0x18
-#define     SR_LCR_PMK 0x28
-#define     SR_LCR_PSP 0x38
-#define     SR_LCR_BRK 0x40
-#define     SR_LCR_DLAB 0x80
-#define   SER_MCR(x)   ((PUCHAR)(x)+4)
-#define     SR_MCR_DTR 0x01
-#define     SR_MCR_RTS 0x02
-#define     SR_MCR_OUT1 0x04
-#define     SR_MCR_OUT2 0x08
-#define     SR_MCR_LOOP 0x10
-#define   SER_LSR(x)   ((PUCHAR)(x)+5)
-#define     SR_LSR_DR  0x01
-#define     SR_LSR_TBE 0x20
-#define   SER_MSR(x)   ((PUCHAR)(x)+6)
-#define     SR_MSR_CTS 0x10
-#define     SR_MSR_DSR 0x20
-#define   SER_SCR(x)   ((PUCHAR)(x)+7)
-
-
-/* GLOBAL VARIABLES *********************************************************/
-
-/* STATIC VARIABLES *********************************************************/
-
-static KD_PORT_INFORMATION DefaultPort = { 0, 0, 0 };
-
-/* The com port must only be initialized once! */
-static BOOLEAN PortInitialized = FALSE;
-
-
-/* FUNCTIONS ****************************************************************/
-
-/* HAL.KdPortInitialize */
-BOOLEAN
-NTAPI
-KdPortInitialize(
-    IN PKD_PORT_INFORMATION PortInformation,
-    IN ULONG Unknown1,
-    IN ULONG Unknown2)
-{
-    SIZE_T i;
-    CHAR buffer[80];
-
-    if (!PortInitialized)
-    {
-        DefaultPort.BaudRate = PortInformation->BaudRate;
-
-        if (PortInformation->ComPort == 0)
-        {
-            /*
-             * Start enumerating COM ports from the last one to the first one,
-             * and break when we find a valid port.
-             * If we reach the first element of the list, the invalid COM port,
-             * then it means that no valid port was found.
-             */
-            for (i = sizeof(BaseArray) / sizeof(BaseArray[0]) - 1; i > 0; i--)
-            {
-                if (CpDoesPortExist(UlongToPtr(BaseArray[i])))
-                {
-                    PortInformation->BaseAddress = DefaultPort.BaseAddress = BaseArray[i];
-                    PortInformation->ComPort     = DefaultPort.ComPort     = i;
-                    break;
-                }
-            }
-            if (i == 0)
-            {
-                sprintf(buffer,
-                        "\nKernel Debugger: No COM port found!\n\n");
-                HalDisplayString(buffer);
-                return FALSE;
-            }
-        }
-
-        PortInitialized = TRUE;
-    }
-
-    /* initialize port */
-    if (!KdPortInitializeEx(&DefaultPort, Unknown1, Unknown2))
-        return FALSE;
-
-    /* set global info */
-    KdComPortInUse = (PUCHAR)DefaultPort.BaseAddress;
-
-    return TRUE;
-}
-
-
-/* HAL.KdPortInitializeEx ; ReactOS-specific */
-BOOLEAN
-NTAPI
-KdPortInitializeEx(
-    IN PKD_PORT_INFORMATION PortInformation,
-    IN ULONG Unknown1,
-    IN ULONG Unknown2)
-{
-    ULONG ComPortBase;
-    CHAR buffer[80];
-    ULONG divisor;
-    UCHAR lcr;
-
-#ifdef _ARM_
-    UNIMPLEMENTED;
-    return FALSE;
-#endif
-
-    if (PortInformation->BaudRate == 0)
-        PortInformation->BaudRate = DEFAULT_BAUD_RATE;
-
-    if (PortInformation->ComPort != 0)
-    {
-        if (!CpDoesPortExist(UlongToPtr(BaseArray[PortInformation->ComPort])))
-        {
-            sprintf(buffer,
-                    "\nKernel Debugger: Serial port not found!\n\n");
-            HalDisplayString(buffer);
-            return FALSE;
-        }
-
-        ComPortBase = BaseArray[PortInformation->ComPort];
-        PortInformation->BaseAddress = ComPortBase;
-    }
-    else
-    {
-        ComPortBase = PortInformation->BaseAddress;
-    }
-
-    if (ComPortBase == 0)
-        return FALSE;
-
-#ifndef NDEBUG
-    sprintf(buffer,
-            "\nSerial port COM%ld found at 0x%lx\n",
-            PortInformation->ComPort,
-            ComPortBase);
-    HalDisplayString(buffer);
-#endif /* NDEBUG */
-
-    /* set baud rate and data format (8N1) */
-
-    /*  turn on DTR and RTS  */
-    WRITE_PORT_UCHAR(SER_MCR(ComPortBase), SR_MCR_DTR | SR_MCR_RTS);
-
-    /* set DLAB */
-    lcr = READ_PORT_UCHAR(SER_LCR(ComPortBase)) | SR_LCR_DLAB;
-    WRITE_PORT_UCHAR(SER_LCR(ComPortBase), lcr);
-
-    /* set baud rate */
-    divisor = 115200 / PortInformation->BaudRate;
-    WRITE_PORT_UCHAR(SER_DLL(ComPortBase), (UCHAR)(divisor & 0xff));
-    WRITE_PORT_UCHAR(SER_DLM(ComPortBase), (UCHAR)((divisor >> 8) & 0xff));
-
-    /* reset DLAB and set 8N1 format */
-    WRITE_PORT_UCHAR(SER_LCR(ComPortBase),
-                     SR_LCR_CS8 | SR_LCR_ST1 | SR_LCR_PNO);
-
-    /* read junk out of the RBR */
-    lcr = READ_PORT_UCHAR(SER_RBR(ComPortBase));
-
-#ifndef NDEBUG
-    /* print message to blue screen */
-    sprintf(buffer,
-            "\nKernel Debugger: COM%ld (Port 0x%lx) BaudRate %ld\n\n",
-            PortInformation->ComPort,
-            ComPortBase,
-            PortInformation->BaudRate);
-
-    HalDisplayString(buffer);
-#endif /* NDEBUG */
-
-    return TRUE;
-}
-
-
-/* HAL.KdPortGetByte */
-BOOLEAN
-NTAPI
-KdPortGetByte(
-    OUT PUCHAR ByteReceived)
-{
-    if (!PortInitialized)
-        return FALSE;
-    return KdPortGetByteEx(&DefaultPort, ByteReceived);
-}
-
-
-/* HAL.KdPortGetByteEx ; ReactOS-specific */
-BOOLEAN
-NTAPI
-KdPortGetByteEx(
-    IN PKD_PORT_INFORMATION PortInformation,
-    OUT PUCHAR ByteReceived)
-{
-    PUCHAR ComPortBase = (PUCHAR)PortInformation->BaseAddress;
-
-    if ((READ_PORT_UCHAR(SER_LSR(ComPortBase)) & SR_LSR_DR))
-    {
-        *ByteReceived = READ_PORT_UCHAR(SER_RBR(ComPortBase));
-        return TRUE;
-    }
-
-    return FALSE;
-}
-
-
-/* HAL.KdPortPollByte */
-BOOLEAN
-NTAPI
-KdPortPollByte(
-    OUT PUCHAR ByteReceived)
-{
-    if (!PortInitialized)
-        return FALSE;
-    return KdPortPollByteEx(&DefaultPort, ByteReceived);
-}
-
-
-/* HAL.KdPortPollByteEx ; ReactOS-specific */
-BOOLEAN
-NTAPI
-KdPortPollByteEx(
-    IN PKD_PORT_INFORMATION PortInformation,
-    OUT PUCHAR ByteReceived)
-{
-    PUCHAR ComPortBase = (PUCHAR)PortInformation->BaseAddress;
-
-    while ((READ_PORT_UCHAR(SER_LSR(ComPortBase)) & SR_LSR_DR) == 0)
-        ;
-
-    *ByteReceived = READ_PORT_UCHAR(SER_RBR(ComPortBase));
-
-    return TRUE;
-}
-
-
-/* HAL.KdPortPutByte */
-VOID
-NTAPI
-KdPortPutByte(
-    IN UCHAR ByteToSend)
-{
-    if (!PortInitialized)
-        return;
-    KdPortPutByteEx(&DefaultPort, ByteToSend);
-}
-
-/* HAL.KdPortPutByteEx ; ReactOS-specific */
-VOID
-NTAPI
-KdPortPutByteEx(
-    IN PKD_PORT_INFORMATION PortInformation,
-    IN UCHAR ByteToSend)
-{
-    PUCHAR ComPortBase = (PUCHAR)PortInformation->BaseAddress;
-
-    while ((READ_PORT_UCHAR(SER_LSR(ComPortBase)) & SR_LSR_TBE) == 0)
-        ;
-
-    WRITE_PORT_UCHAR(SER_THR(ComPortBase), ByteToSend);
-}
-
-
-/* HAL.KdPortRestore */
-VOID
-NTAPI
-KdPortRestore(VOID)
-{
-    UNIMPLEMENTED;
-}
-
-
-/* HAL.KdPortSave */
-VOID
-NTAPI
-KdPortSave(VOID)
-{
-    UNIMPLEMENTED;
-}
-
-
-/* HAL.KdPortDisableInterrupts */
-BOOLEAN
-NTAPI
-KdPortDisableInterrupts(VOID)
-{
-    UCHAR ch;
-
-    if (!PortInitialized)
-        return FALSE;
-
-    ch = READ_PORT_UCHAR(SER_MCR(DefaultPort.BaseAddress));
-    ch &= (~(SR_MCR_OUT1 | SR_MCR_OUT2));
-    WRITE_PORT_UCHAR(SER_MCR(DefaultPort.BaseAddress), ch);
-
-    ch = READ_PORT_UCHAR(SER_IER(DefaultPort.BaseAddress));
-    ch &= (~SR_IER_ALL);
-    WRITE_PORT_UCHAR(SER_IER(DefaultPort.BaseAddress), ch);
-
-    return TRUE;
-}
-
-
-/* HAL.KdPortEnableInterrupts */
-BOOLEAN
-NTAPI
-KdPortEnableInterrupts(VOID)
-{
-    UCHAR ch;
-
-    if (PortInitialized == FALSE)
-        return FALSE;
-
-    ch = READ_PORT_UCHAR(SER_IER(DefaultPort.BaseAddress));
-    ch &= (~SR_IER_ALL);
-    ch |= SR_IER_ERDA;
-    WRITE_PORT_UCHAR(SER_IER(DefaultPort.BaseAddress), ch);
-
-    ch = READ_PORT_UCHAR(SER_MCR(DefaultPort.BaseAddress));
-    ch &= (~SR_MCR_LOOP);
-    ch |= (SR_MCR_OUT1 | SR_MCR_OUT2);
-    WRITE_PORT_UCHAR(SER_MCR(DefaultPort.BaseAddress), ch);
-
-    return TRUE;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS
-NTAPI
-KdDebuggerInitialize0(
-    IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
-{
-    return STATUS_NOT_IMPLEMENTED;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS
-NTAPI
-KdDebuggerInitialize1(
-    IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
-{
-    return STATUS_NOT_IMPLEMENTED;
-}
-
-/*
- * @implemented
- */
-NTSTATUS
-NTAPI
-KdSave(
-    IN BOOLEAN SleepTransition)
-{
-    /* Nothing to do on COM ports */
-    return STATUS_SUCCESS;
-}
-
-/*
- * @implemented
- */
-NTSTATUS
-NTAPI
-KdRestore(
-    IN BOOLEAN SleepTransition)
-{
-    /* Nothing to do on COM ports */
-    return STATUS_SUCCESS;
-}
-
-/*
- * @unimplemented
- */
-VOID
-NTAPI
-KdSendPacket(
-    IN ULONG PacketType,
-    IN PSTRING MessageHeader,
-    IN PSTRING MessageData,
-    IN OUT PKD_CONTEXT Context)
-{
-    UNIMPLEMENTED;
-    return;
-}
-
-/*
- * @unimplemented
- */
-KDSTATUS
-NTAPI
-KdReceivePacket(
-    IN ULONG PacketType,
-    OUT PSTRING MessageHeader,
-    OUT PSTRING MessageData,
-    OUT PULONG DataLength,
-    IN OUT PKD_CONTEXT Context)
-{
-    UNIMPLEMENTED;
-    return 0;
-}
-
-/* EOF */
diff --git a/drivers/filesystems/ext2/inc/errmsg.h b/drivers/filesystems/ext2/inc/errmsg.h
deleted file mode 100644 (file)
index 8f8ac96..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*************************************************************************
-*
-* File:                errmsg.msg
-*
-* Product:             Ext2 FSD
-*
-* Module:              Ext2 FSD Event Log Messages
-*
-* Description:
-*     Contains error strings in a format understandable to the message compiler.
-*     Please compile (using mc) with the -c option which will set the
-*     "Customer" bit in all errors.
-*     Use values beginning at 0xA000 (e.g. 0xA001) for the Ext2 FSD
-*     errors.
-*     Do NOT use %1 for insertion strings. The I/O manager assumes that
-*     the first insertion string is the name of the driver/device.
-*
-*
-*************************************************************************/
-//
-//  Values are 32 bit values layed out as follows:
-//
-//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
-//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
-//  +---+-+-+-----------------------+-------------------------------+
-//  |Sev|C|R|     Facility          |               Code            |
-//  +---+-+-+-----------------------+-------------------------------+
-//
-//  where
-//
-//      Sev - is the severity code
-//
-//          00 - Success
-//          01 - Informational
-//          10 - Warning
-//          11 - Error
-//
-//      C - is the Customer code flag
-//
-//      R - is a reserved bit
-//
-//      Facility - is the facility code
-//
-//      Code - is the facility's status code
-//
-//
-// Define the facility codes
-//
-
-
-//
-// Define the severity codes
-//
-#define STATUS_SEVERITY_WARNING          0x2
-#define STATUS_SEVERITY_SUCCESS          0x0
-#define STATUS_SEVERITY_INFORMATIONAL    0x1
-#define STATUS_SEVERITY_ERROR            0x3
-
-
-//
-// MessageId: EXT2_ERROR_INTERNAL_ERROR
-//
-// MessageText:
-//
-//  The Ext2 FSD encountered an internal error. Please check log data information.
-//
-#define EXT2_ERROR_INTERNAL_ERROR        ((ULONG)0xE004A001L)
-
diff --git a/drivers/filesystems/ext2/inc/ext2_fs.h b/drivers/filesystems/ext2/inc/ext2_fs.h
deleted file mode 100644 (file)
index 4a545d4..0000000
+++ /dev/null
@@ -1,615 +0,0 @@
-/*
- *  linux/include/linux/ext2_fs.h
- *
- * Copyright (C) 1992, 1993, 1994, 1995
- * Remy Card (card@masi.ibp.fr)
- * Laboratoire MASI - Institut Blaise Pascal
- * Universite Pierre et Marie Curie (Paris VI)
- *
- *  from
- *
- *  linux/include/linux/minix_fs.h
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- */
-
-#ifndef _LINUX_EXT2_FS_H
-#define _LINUX_EXT2_FS_H
-
-//     #include <linux/types.h>
-
-/*
- * The second extended filesystem constants/structures
- */
-
-
-/*
- * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
- */
-#define EXT2_PREALLOCATE
-#define EXT2_DEFAULT_PREALLOC_BLOCKS   8
-
-/*
- * The second extended file system version
- */
-#define EXT2FS_DATE            "95/08/09"
-#define EXT2FS_VERSION         "0.5b"
-
-/*
- * Debug code
- */
-
-/*
- * Special inodes numbers
- */
-#define        EXT2_BAD_INO             1      /* Bad blocks inode */
-#define EXT2_ROOT_INO           2      /* Root inode */
-#define EXT2_ACL_IDX_INO        3      /* ACL inode */
-#define EXT2_ACL_DATA_INO       4      /* ACL inode */
-#define EXT2_BOOT_LOADER_INO    5      /* Boot loader inode */
-#define EXT2_UNDEL_DIR_INO      6      /* Undelete directory inode */
-
-/* First non-reserved inode for old ext2 filesystems */
-#define EXT2_GOOD_OLD_FIRST_INO        11
-
-/*
- * The second extended file system magic number
- */
-#define EXT2_SUPER_MAGIC       0xEF53
-
-/*
- * Maximal count of links to a file
- */
-#define EXT2_LINK_MAX          32000
-
-/*
- * Macro-instructions used to manage several block sizes
- */
-#define EXT2_MIN_BLOCK_SIZE            1024
-#define        EXT2_MAX_BLOCK_SIZE             4096
-#define EXT2_MIN_BLOCK_LOG_SIZE                  10
-#ifdef __KERNEL__
-# define EXT2_BLOCK_SIZE(s)            ((s)->s_blocksize)
-#else
-# define EXT2_BLOCK_SIZE(s)            (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
-#endif
-#define EXT2_ACLE_PER_BLOCK(s)         (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_acl_entry))
-#define        EXT2_ADDR_PER_BLOCK(s)          (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
-#ifdef __KERNEL__
-# define EXT2_BLOCK_SIZE_BITS(s)       ((s)->s_blocksize_bits)
-#else
-# define EXT2_BLOCK_SIZE_BITS(s)       ((s)->s_log_block_size + 10)
-#endif
-#ifdef __KERNEL__
-#define        EXT2_ADDR_PER_BLOCK_BITS(s)     ((s)->u.ext2_sb.s_addr_per_block_bits)
-#define EXT2_INODE_SIZE(s)             ((s)->u.ext2_sb.s_inode_size)
-#define EXT2_FIRST_INO(s)              ((s)->u.ext2_sb.s_first_ino)
-#else
-#define EXT2_INODE_SIZE(s)     (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
-                                EXT2_GOOD_OLD_INODE_SIZE : \
-                                (s)->s_inode_size)
-#define EXT2_FIRST_INO(s)      (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
-                                EXT2_GOOD_OLD_FIRST_INO : \
-                                (s)->s_first_ino)
-#endif
-
-/*
- * Macro-instructions used to manage fragments
- */
-#define EXT2_MIN_FRAG_SIZE             1024
-#define        EXT2_MAX_FRAG_SIZE              4096
-#define EXT2_MIN_FRAG_LOG_SIZE           10
-#ifdef __KERNEL__
-# define EXT2_FRAG_SIZE(s)             ((s)->u.ext2_sb.s_frag_size)
-# define EXT2_FRAGS_PER_BLOCK(s)       ((s)->u.ext2_sb.s_frags_per_block)
-#else
-# define EXT2_FRAG_SIZE(s)             (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
-# define EXT2_FRAGS_PER_BLOCK(s)       (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
-#endif
-
-/*
- * ACL structures
- */
-struct ext2_acl_header /* Header of Access Control Lists */
-{
-       __u32   aclh_size;
-       __u32   aclh_file_count;
-       __u32   aclh_acle_count;
-       __u32   aclh_first_acle;
-};
-
-struct ext2_acl_entry  /* Access Control List Entry */
-{
-       __u32   acle_size;
-       __u16   acle_perms;     /* Access permissions */
-       __u16   acle_type;      /* Type of entry */
-       __u16   acle_tag;       /* User or group identity */
-       __u16   acle_pad1;
-       __u32   acle_next;      /* Pointer on next entry for the */
-                                       /* same inode or on next free entry */
-};
-
-/*
- * Structure of a blocks group descriptor
- */
-struct ext2_group_desc
-{
-       __u32   bg_block_bitmap;                /* Blocks bitmap block */
-       __u32   bg_inode_bitmap;                /* Inodes bitmap block */
-       __u32   bg_inode_table;         /* Inodes table block */
-       __u16   bg_free_blocks_count;   /* Free blocks count */
-       __u16   bg_free_inodes_count;   /* Free inodes count */
-       __u16   bg_used_dirs_count;     /* Directories count */
-       __u16   bg_pad;
-       __u32   bg_reserved[3];
-};
-
-/*
- * Macro-instructions used to manage group descriptors
- */
-#ifdef __KERNEL__
-# define EXT2_BLOCKS_PER_GROUP(s)      ((s)->u.ext2_sb.s_blocks_per_group)
-# define EXT2_DESC_PER_BLOCK(s)                ((s)->u.ext2_sb.s_desc_per_block)
-# define EXT2_INODES_PER_GROUP(s)      ((s)->u.ext2_sb.s_inodes_per_group)
-# define EXT2_DESC_PER_BLOCK_BITS(s)   ((s)->u.ext2_sb.s_desc_per_block_bits)
-#else
-# define EXT2_BLOCKS_PER_GROUP(s)      ((s)->s_blocks_per_group)
-# define EXT2_DESC_PER_BLOCK(s)                (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
-# define EXT2_INODES_PER_GROUP(s)      ((s)->s_inodes_per_group)
-#endif
-
-/*
- * Constants relative to the data blocks
- */
-#define        EXT2_NDIR_BLOCKS                12
-#define        EXT2_IND_BLOCK                  EXT2_NDIR_BLOCKS
-#define        EXT2_DIND_BLOCK                 (EXT2_IND_BLOCK + 1)
-#define        EXT2_TIND_BLOCK                 (EXT2_DIND_BLOCK + 1)
-#define        EXT2_N_BLOCKS                   (EXT2_TIND_BLOCK + 1)
-
-/*
- * Inode flags
- */
-#define        EXT2_SECRM_FL                   0x00000001 /* Secure deletion */
-#define        EXT2_UNRM_FL                    0x00000002 /* Undelete */
-#define        EXT2_COMPR_FL                   0x00000004 /* Compress file */
-#define EXT2_SYNC_FL                   0x00000008 /* Synchronous updates */
-#define EXT2_IMMUTABLE_FL              0x00000010 /* Immutable file */
-#define EXT2_APPEND_FL                 0x00000020 /* writes to file may only append */
-#define EXT2_NODUMP_FL                 0x00000040 /* do not dump file */
-#define EXT2_NOATIME_FL                        0x00000080 /* do not update atime */
-/* Reserved for compression usage... */
-#define EXT2_DIRTY_FL                  0x00000100
-#define EXT2_COMPRBLK_FL               0x00000200 /* One or more compressed clusters */
-#define EXT2_NOCOMP_FL                 0x00000400 /* Don't compress */
-#define EXT2_ECOMPR_FL                 0x00000800 /* Compression error */
-/* End compression flags --- maybe not all used */     
-#define EXT2_BTREE_FL                  0x00001000 /* btree format dir */
-#define EXT2_RESERVED_FL               0x80000000 /* reserved for ext2 lib */
-
-#define EXT2_FL_USER_VISIBLE           0x00001FFF /* User visible flags */
-#define EXT2_FL_USER_MODIFIABLE                0x000000FF /* User modifiable flags */
-
-/*
- * ioctl commands
- */
-#define        EXT2_IOC_GETFLAGS               _IOR('f', 1, long)
-#define        EXT2_IOC_SETFLAGS               _IOW('f', 2, long)
-#define        EXT2_IOC_GETVERSION             _IOR('v', 1, long)
-#define        EXT2_IOC_SETVERSION             _IOW('v', 2, long)
-
-/*
- * Structure of an inode on the disk
- */
-struct ext2_inode {
-       __u16   i_mode;         /* File mode */
-       __u16   i_uid;          /* Low 16 bits of Owner Uid */
-       __u32   i_size;         /* Size in bytes */
-       __u32   i_atime;        /* Access time */
-       __u32   i_ctime;        /* Creation time */
-       __u32   i_mtime;        /* Modification time */
-       __u32   i_dtime;        /* Deletion Time */
-       __u16   i_gid;          /* Low 16 bits of Group Id */
-       __u16   i_links_count;  /* Links count */
-       __u32   i_blocks;       /* Blocks count */
-       __u32   i_flags;        /* File flags */
-       union {
-               struct {
-                       __u32  l_i_reserved1;
-               } linux1;
-               struct {
-                       __u32  h_i_translator;
-               } hurd1;
-               struct {
-                       __u32  m_i_reserved1;
-               } masix1;
-       } osd1;                         /* OS dependent 1 */
-       __u32   i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
-       __u32   i_generation;   /* File version (for NFS) */
-       __u32   i_file_acl;     /* File ACL */
-       __u32   i_dir_acl;      /* Directory ACL */
-       __u32   i_faddr;        /* Fragment address */
-       union {
-               struct {
-                       __u8    l_i_frag;       /* Fragment number */
-                       __u8    l_i_fsize;      /* Fragment size */
-                       __u16   i_pad1;
-                       __u16   l_i_uid_high;   /* these 2 fields    */
-                       __u16   l_i_gid_high;   /* were reserved2[0] */
-                       __u32   l_i_reserved2;
-               } linux2;
-               struct {
-                       __u8    h_i_frag;       /* Fragment number */
-                       __u8    h_i_fsize;      /* Fragment size */
-                       __u16   h_i_mode_high;
-                       __u16   h_i_uid_high;
-                       __u16   h_i_gid_high;
-                       __u32   h_i_author;
-               } hurd2;
-               struct {
-                       __u8    m_i_frag;       /* Fragment number */
-                       __u8    m_i_fsize;      /* Fragment size */
-                       __u16   m_pad1;
-                       __u32   m_i_reserved2[2];
-               } masix2;
-       } osd2;                         /* OS dependent 2 */
-};
-
-#define i_size_high    i_dir_acl
-
-#if defined(__KERNEL__) || defined(__linux__)
-#define i_reserved1    osd1.linux1.l_i_reserved1
-#define i_frag         osd2.linux2.l_i_frag
-#define i_fsize                osd2.linux2.l_i_fsize
-#define i_uid_low      i_uid
-#define i_gid_low      i_gid
-#define i_uid_high     osd2.linux2.l_i_uid_high
-#define i_gid_high     osd2.linux2.l_i_gid_high
-#define i_reserved2    osd2.linux2.l_i_reserved2
-#endif
-
-#ifdef __hurd__
-#define i_translator   osd1.hurd1.h_i_translator
-#define i_frag         osd2.hurd2.h_i_frag;
-#define i_fsize                osd2.hurd2.h_i_fsize;
-#define i_uid_high     osd2.hurd2.h_i_uid_high
-#define i_gid_high     osd2.hurd2.h_i_gid_high
-#define i_author       osd2.hurd2.h_i_author
-#endif
-
-#ifdef __masix__
-#define i_reserved1    osd1.masix1.m_i_reserved1
-#define i_frag         osd2.masix2.m_i_frag
-#define i_fsize                osd2.masix2.m_i_fsize
-#define i_reserved2    osd2.masix2.m_i_reserved2
-#endif
-
-/*
- * File system states
- */
-#define        EXT2_VALID_FS                   0x0001  /* Unmounted cleanly */
-#define        EXT2_ERROR_FS                   0x0002  /* Errors detected */
-
-/*
- * Mount flags
- */
-#define EXT2_MOUNT_CHECK               0x0001  /* Do mount-time checks */
-#define EXT2_MOUNT_GRPID               0x0004  /* Create files with directory's group */
-#define EXT2_MOUNT_DEBUG               0x0008  /* Some debugging messages */
-#define EXT2_MOUNT_ERRORS_CONT         0x0010  /* Continue on errors */
-#define EXT2_MOUNT_ERRORS_RO           0x0020  /* Remount fs ro on errors */
-#define EXT2_MOUNT_ERRORS_PANIC                0x0040  /* Panic on errors */
-#define EXT2_MOUNT_MINIX_DF            0x0080  /* Mimics the Minix statfs */
-#define EXT2_MOUNT_NO_UID32            0x0200  /* Disable 32-bit UIDs */
-
-#define clear_opt(o, opt)              o &= ~EXT2_MOUNT_##opt
-#define set_opt(o, opt)                        o |= EXT2_MOUNT_##opt
-#define test_opt(sb, opt)              ((sb)->u.ext2_sb.s_mount_opt & \
-                                        EXT2_MOUNT_##opt)
-/*
- * Maximal mount counts between two filesystem checks
- */
-#define EXT2_DFL_MAX_MNT_COUNT         20      /* Allow 20 mounts */
-#define EXT2_DFL_CHECKINTERVAL         0       /* Don't use interval check */
-
-/*
- * Behaviour when detecting errors
- */
-#define EXT2_ERRORS_CONTINUE           1       /* Continue execution */
-#define EXT2_ERRORS_RO                 2       /* Remount fs read-only */
-#define EXT2_ERRORS_PANIC              3       /* Panic */
-#define EXT2_ERRORS_DEFAULT            EXT2_ERRORS_CONTINUE
-
-/*
- * Structure of the super block
- */
-struct ext2_super_block {
-       __u32   s_inodes_count;         /* Inodes count */
-       __u32   s_blocks_count;         /* Blocks count */
-       __u32   s_r_blocks_count;       /* Reserved blocks count */
-       __u32   s_free_blocks_count;    /* Free blocks count */
-       __u32   s_free_inodes_count;    /* Free inodes count */
-       __u32   s_first_data_block;     /* First Data Block */
-       __u32   s_log_block_size;       /* Block size */
-       __s32   s_log_frag_size;        /* Fragment size */
-       __u32   s_blocks_per_group;     /* # Blocks per group */
-       __u32   s_frags_per_group;      /* # Fragments per group */
-       __u32   s_inodes_per_group;     /* # Inodes per group */
-       __u32   s_mtime;                /* Mount time */
-       __u32   s_wtime;                /* Write time */
-       __u16   s_mnt_count;            /* Mount count */
-       __s16   s_max_mnt_count;        /* Maximal mount count */
-       __u16   s_magic;                /* Magic signature */
-       __u16   s_state;                /* File system state */
-       __u16   s_errors;               /* Behaviour when detecting errors */
-       __u16   s_minor_rev_level;      /* minor revision level */
-       __u32   s_lastcheck;            /* time of last check */
-       __u32   s_checkinterval;        /* max. time between checks */
-       __u32   s_creator_os;           /* OS */
-       __u32   s_rev_level;            /* Revision level */
-       __u16   s_def_resuid;           /* Default uid for reserved blocks */
-       __u16   s_def_resgid;           /* Default gid for reserved blocks */
-       /*
-        * These fields are for EXT2_DYNAMIC_REV superblocks only.
-        *
-        * Note: the difference between the compatible feature set and
-        * the incompatible feature set is that if there is a bit set
-        * in the incompatible feature set that the kernel doesn't
-        * know about, it should refuse to mount the filesystem.
-        * 
-        * e2fsck's requirements are more strict; if it doesn't know
-        * about a feature in either the compatible or incompatible
-        * feature set, it must abort and not try to meddle with
-        * things it doesn't understand...
-        */
-       __u32   s_first_ino;            /* First non-reserved inode */
-       __u16   s_inode_size;           /* size of inode structure */
-       __u16   s_block_group_nr;       /* block group # of this superblock */
-       __u32   s_feature_compat;       /* compatible feature set */
-       __u32   s_feature_incompat;     /* incompatible feature set */
-       __u32   s_feature_ro_compat;    /* readonly-compatible feature set */
-       __u8    s_uuid[16];             /* 128-bit uuid for volume */
-       char    s_volume_name[16];      /* volume name */
-       char    s_last_mounted[64];     /* directory where last mounted */
-       __u32   s_algorithm_usage_bitmap; /* For compression */
-       /*
-        * Performance hints.  Directory preallocation should only
-        * happen if the EXT2_COMPAT_PREALLOC flag is on.
-        */
-       __u8    s_prealloc_blocks;      /* Nr of blocks to try to preallocate*/
-       __u8    s_prealloc_dir_blocks;  /* Nr to preallocate for dirs */
-       __u16   s_padding1;
-       __u32   s_reserved[204];        /* Padding to the end of the block */
-};
-
-#ifdef __KERNEL__
-#define EXT2_SB(sb)    (&((sb)->u.ext2_sb))
-#else
-/* Assume that user mode programs are passing in an ext2fs superblock, not
- * a kernel struct super_block.  This will allow us to call the feature-test
- * macros from user land. */
-#define EXT2_SB(sb)    (sb)
-#endif
-
-/*
- * Codes for operating systems
- */
-#define EXT2_OS_LINUX          0
-#define EXT2_OS_HURD           1
-#define EXT2_OS_MASIX          2
-#define EXT2_OS_FREEBSD                3
-#define EXT2_OS_LITES          4
-
-/*
- * Revision levels
- */
-#define EXT2_GOOD_OLD_REV      0       /* The good old (original) format */
-#define EXT2_DYNAMIC_REV       1       /* V2 format w/ dynamic inode sizes */
-
-#define EXT2_CURRENT_REV       EXT2_GOOD_OLD_REV
-#define EXT2_MAX_SUPP_REV      EXT2_DYNAMIC_REV
-
-#define EXT2_GOOD_OLD_INODE_SIZE 128
-
-/*
- * Feature set definitions
- */
-
-#define EXT2_HAS_COMPAT_FEATURE(sb,mask)                       \
-       ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
-#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask)                    \
-       ( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
-#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask)                     \
-       ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
-#define EXT2_SET_COMPAT_FEATURE(sb,mask)                       \
-       EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
-#define EXT2_SET_RO_COMPAT_FEATURE(sb,mask)                    \
-       EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
-#define EXT2_SET_INCOMPAT_FEATURE(sb,mask)                     \
-       EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
-#define EXT2_CLEAR_COMPAT_FEATURE(sb,mask)                     \
-       EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
-#define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask)                  \
-       EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
-#define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask)                   \
-       EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
-
-#define EXT2_FEATURE_COMPAT_DIR_PREALLOC       0x0001
-
-#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER    0x0001
-#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE      0x0002
-#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR       0x0004
-
-#define EXT2_FEATURE_INCOMPAT_COMPRESSION      0x0001
-#define EXT2_FEATURE_INCOMPAT_FILETYPE         0x0002
-
-#define EXT2_FEATURE_COMPAT_SUPP       0
-#define EXT2_FEATURE_INCOMPAT_SUPP     EXT2_FEATURE_INCOMPAT_FILETYPE
-#define EXT2_FEATURE_RO_COMPAT_SUPP    (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
-                                        EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
-                                        EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
-
-/*
- * Default values for user and/or group using reserved blocks
- */
-#define        EXT2_DEF_RESUID         0
-#define        EXT2_DEF_RESGID         0
-
-/*
- * Structure of a directory entry
- */
-#define EXT2_NAME_LEN 255
-
-struct ext2_dir_entry {
-       __u32   inode;                  /* Inode number */
-       __u16   rec_len;                /* Directory entry length */
-       __u16   name_len;               /* Name length */
-       char    name[EXT2_NAME_LEN];    /* File name */
-};
-
-/*
- * The new version of the directory entry.  Since EXT2 structures are
- * stored in intel byte order, and the name_len field could never be
- * bigger than 255 chars, it's safe to reclaim the extra byte for the
- * file_type field.
- */
-struct ext2_dir_entry_2 {
-       __u32   inode;                  /* Inode number */
-       __u16   rec_len;                /* Directory entry length */
-       __u8    name_len;               /* Name length */
-       __u8    file_type;
-       char    name[EXT2_NAME_LEN];    /* File name */
-};
-
-/*
- * Ext2 directory file types.  Only the low 3 bits are used.  The
- * other bits are reserved for now.
- */
-#define EXT2_FT_UNKNOWN                0
-#define EXT2_FT_REG_FILE       1
-#define EXT2_FT_DIR                    2
-#define EXT2_FT_CHRDEV         3
-#define EXT2_FT_BLKDEV                 4
-#define EXT2_FT_FIFO           5
-#define EXT2_FT_SOCK           6
-#define EXT2_FT_SYMLINK                7
-
-#define EXT2_FT_MAX            8
-
-/*
- * EXT2_DIR_PAD defines the directory entries boundaries
- *
- * NOTE: It must be a multiple of 4
- */
-#define EXT2_DIR_PAD                   4
-#define EXT2_DIR_ROUND                         (EXT2_DIR_PAD - 1)
-#define EXT2_DIR_REC_LEN(name_len)     (((name_len) + 8 + EXT2_DIR_ROUND) & \
-                                        ~EXT2_DIR_ROUND)
-
-#ifdef __KERNEL__
-/*
- * Function prototypes
- */
-
-/*
- * Ok, these declarations are also in <linux/kernel.h> but none of the
- * ext2 source programs needs to include it so they are duplicated here.
- */
-# define NORET_TYPE    /**/
-# define ATTRIB_NORET  __attribute__((noreturn))
-# define NORET_AND     noreturn,
-
-/* acl.c */
-extern int ext2_permission (struct inode *, int);
-
-/* balloc.c */
-extern int ext2_bg_has_super(struct super_block *sb, int group);
-extern unsigned long ext2_bg_num_gdb(struct super_block *sb, int group);
-extern int ext2_new_block (struct inode *, unsigned long,
-                          __u32 *, __u32 *, int *);
-extern void ext2_free_blocks (struct inode *, unsigned long,
-                             unsigned long);
-extern unsigned long ext2_count_free_blocks (struct super_block *);
-extern void ext2_check_blocks_bitmap (struct super_block *);
-extern struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
-                                                   unsigned int block_group,
-                                                   struct buffer_head ** bh);
-
-/* bitmap.c */
-extern unsigned long ext2_count_free (struct buffer_head *, unsigned);
-
-/* dir.c */
-extern int ext2_check_dir_entry (const char *, struct inode *,
-                                struct ext2_dir_entry_2 *, struct buffer_head *,
-                                unsigned long);
-
-/* file.c */
-extern int ext2_read (struct inode *, struct file *, char *, int);
-extern int ext2_write (struct inode *, struct file *, char *, int);
-
-/* fsync.c */
-extern int ext2_sync_file (struct file *, struct dentry *, int);
-extern int ext2_fsync_inode (struct inode *, int);
-
-/* ialloc.c */
-extern struct inode * ext2_new_inode (const struct inode *, int);
-extern void ext2_free_inode (struct inode *);
-extern unsigned long ext2_count_free_inodes (struct super_block *);
-extern void ext2_check_inodes_bitmap (struct super_block *);
-
-/* inode.c */
-
-extern struct buffer_head * ext2_getblk (struct inode *, long, int, int *);
-extern struct buffer_head * ext2_bread (struct inode *, int, int, int *);
-
-extern void ext2_read_inode (struct inode *);
-extern void ext2_write_inode (struct inode *, int);
-extern void ext2_put_inode (struct inode *);
-extern void ext2_delete_inode (struct inode *);
-extern int ext2_sync_inode (struct inode *);
-extern void ext2_discard_prealloc (struct inode *);
-
-/* ioctl.c */
-extern int ext2_ioctl (struct inode *, struct file *, unsigned int,
-                      unsigned long);
-
-/* namei.c */
-extern struct inode_operations ext2_dir_inode_operations;
-
-/* super.c */
-extern void ext2_error (struct super_block *, const char *, const char *, ...)
-       __attribute__ ((format (printf, 3, 4)));
-extern NORET_TYPE void ext2_panic (struct super_block *, const char *,
-                                  const char *, ...)
-       __attribute__ ((NORET_AND format (printf, 3, 4)));
-extern void ext2_warning (struct super_block *, const char *, const char *, ...)
-       __attribute__ ((format (printf, 3, 4)));
-extern void ext2_update_dynamic_rev (struct super_block *sb);
-extern void ext2_put_super (struct super_block *);
-extern void ext2_write_super (struct super_block *);
-extern int ext2_remount (struct super_block *, int *, char *);
-extern struct super_block * ext2_read_super (struct super_block *,void *,int);
-extern int ext2_statfs (struct super_block *, struct statfs *);
-
-/* truncate.c */
-extern void ext2_truncate (struct inode *);
-
-/*
- * Inodes and files operations
- */
-
-/* dir.c */
-extern struct file_operations ext2_dir_operations;
-
-/* file.c */
-extern struct inode_operations ext2_file_inode_operations;
-extern struct file_operations ext2_file_operations;
-
-/* symlink.c */
-extern struct inode_operations ext2_fast_symlink_inode_operations;
-
-extern struct address_space_operations ext2_aops;
-
-#endif /* __KERNEL__ */
-
-#endif /* _LINUX_EXT2_FS_H */
diff --git a/drivers/filesystems/ext2/inc/ext2fsd.h b/drivers/filesystems/ext2/inc/ext2fsd.h
deleted file mode 100644 (file)
index 42baa7f..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-/*************************************************************************
-*
-* File: ext2fsd.h
-*
-* Module: Ext2 File System Driver (Kernel mode execution only)
-*
-* Description:
-*      The main include file for the Ext2 file system driver.
-*
-* Author: Manoj Paul Joseph
-*
-*
-*************************************************************************/
-
-
-#ifndef        _EXT2_FSD_H_
-#define        _EXT2_FSD_H_
-
-#define EXT2_POOL_WITH_TAG
-
-
-// some constant definitions
-#define        EXT2_PANIC_IDENTIFIER           (0x86427531)
-
-// any directory information EXT2 obtains from the local file system
-//     will use a buffer of the following size ... (in KB)
-#define        EXT2_READ_DIR_BUFFER_LENGTH     (512)
-#define        EXT2_MAXCLOSABLE_FCBS_UL        20
-#define        EXT2_MAXCLOSABLE_FCBS_LL        10
-
-//     Some type definitions...
-//     These are used later...
-
-typedef unsigned int    UINT;
-typedef unsigned char   BYTE;
-
-// Common include files - should be in the include dir of the MS supplied IFS Kit
-#include       <ntifs.h>
-#include <ntdddisk.h>
-
-
-/* REACTOS FIXME */
-#undef DeleteFile
-/* This is deprecated and should be changed in the EXT2FS driver. */
-
-/* FIXME : Those two definitions already exist in wdm.h
-#define RtlLargeIntegerLessThan(a, b) (a).QuadPart < (b).QuadPart
-#define RtlLargeIntegerGreaterThan(a, b) (a).QuadPart > (b).QuadPart
-*/
-
-
-// the following include files should be in the inc sub-dir associated with this driver
-#include       "ext2metadata.h"
-#include       "struct.h"
-#include       "protos.h"
-#include       "errmsg.h"
-
-
-// global variables - minimize these
-extern Ext2Data                                Ext2GlobalData;
-
-// try-finally simulation
-#define try_return(...) { __VA_ARGS__; goto try_exit; }
-#define try_return1(S) { S; goto try_exit1; }
-#define try_return2(S) { S; goto try_exit2; }
-
-// some global (helpful) macros
-#define Ext2IsFlagOn(Flags,SingleFlag) ((BOOLEAN)((((Flags) & (SingleFlag)) != 0)))
-#define        Ext2SetFlag(Flag, Value)        ((Flag) |= (Value))
-#define        Ext2ClearFlag(Flag, Value)      ((Flag) &= ~(Value))
-
-#define        Ext2QuadAlign(Value)                    ((((uint32)(Value)) + 7) & 0xfffffff8)
-
-// to perform a bug-check (panic), the following macro is used
-#define        Ext2Panic(arg1, arg2, arg3)                                     \
-       (KeBugCheckEx(EXT2_PANIC_IDENTIFIER, EXT2_BUG_CHECK_ID | __LINE__, (uint32)(arg1), (uint32)(arg2), (uint32)(arg3)))
-
-// a convenient macro (must be invoked in the context of the thread that acquired the resource)
-#define        Ext2ReleaseResource(Resource)   \
-       (ExReleaseResourceForThreadLite((Resource), ExGetCurrentResourceThread()))
-
-// each file has a unique bug-check identifier associated with it.
-//     Here is a list of constant definitions for these identifiers
-#define        EXT2_FILE_INIT                                                                  (0x00000001)
-#define        EXT2_FILE_REGISTRY                                                              (0x00000002)
-#define        EXT2_FILE_CREATE                                                                (0x00000003)
-#define        EXT2_FILE_CLEANUP                                                               (0x00000004)
-#define        EXT2_FILE_CLOSE                                                                 (0x00000005)
-#define        EXT2_FILE_READ                                                                  (0x00000006)
-#define        EXT2_FILE_WRITE                                                                 (0x00000007)
-#define        EXT2_FILE_INFORMATION                                                   (0x00000008)
-#define        EXT2_FILE_FLUSH                                                                 (0x00000009)
-#define        EXT2_FILE_VOL_INFORMATION                                               (0x0000000A)
-#define        EXT2_FILE_DIR_CONTROL                                                   (0x0000000B)
-#define        EXT2_FILE_FILE_CONTROL                                                  (0x0000000C)
-#define        EXT2_FILE_DEVICE_CONTROL                                                (0x0000000D)
-#define        EXT2_FILE_SHUTDOWN                                                              (0x0000000E)
-#define        EXT2_FILE_LOCK_CONTROL                                                  (0x0000000F)
-#define        EXT2_FILE_SECURITY                                                              (0x00000010)
-#define        EXT2_FILE_EXT_ATTR                                                              (0x00000011)
-#define        EXT2_FILE_MISC                                                                  (0x00000012)
-#define        EXT2_FILE_FAST_IO                                                               (0x00000013)
-#define        EXT2_FILE_IO                                                                    (0x00000014)
-#define        EXT2_FILE_METADATA_IO                                                   (0x00000015)
-
-
-
-#if DBG
-#define        Ext2BreakPoint()        DbgBreakPoint()
-#else
-#define        Ext2BreakPoint()
-#endif
-
-#define Ext2RaiseStatus(IRPCONTEXT,STATUS)             \
-{                                                                                              \
-    (IRPCONTEXT)->ExceptionStatus = (STATUS);  \
-    ExRaiseStatus( (STATUS) );                                 \
-}
-
-#ifdef EXT2_POOL_WITH_TAG
-       #define Ext2AllocatePool(PoolType,NumberOfBytes)        \
-               ExAllocatePoolWithTag( PoolType, NumberOfBytes, '2txE' )
-#else
-       #define Ext2AllocatePool(PoolType,NumberOfBytes)        \
-               ExAllocatePool( PoolType, NumberOfBytes )
-#endif
-
-
-#if DBG
-
-//
-//     Trace types...
-//     Any number of these may be enabled...
-//
-#define DEBUG_TRACE_IRQL                    (0x00000001)
-#define DEBUG_TRACE_IRP_ENTRY                   (0x00000002)
-#define DEBUG_TRACE_RESOURCE_ACQUIRE     (0x00000004)
-#define DEBUG_TRACE_RESOURCE_RELEASE     (0x00000008)
-#define DEBUG_TRACE_RESOURCE_RETRY              (0x00000010)
-#define DEBUG_TRACE_ASYNC                (0x00000020)
-#define DEBUG_TRACE_MOUNT                (0x00000040)
-#define DEBUG_TRACE_RESOURCE_STATE       (0x00000080)
-#define DEBUG_TRACE_MISC                 (0x00000100)
-#define DEBUG_TRACE_FILE_OBJ             (0x00000200)
-#define DEBUG_TRACE_FILE_NAME            (0x00000400)
-#define DEBUG_TRACE_SPECIAL              (0x00000800)
-#define DEBUG_TRACE_ERROR                               (0x00001000)
-#define DEBUG_TRACE_READ_DETAILS                (0x00002000)
-#define DEBUG_TRACE_WRITE_DETAILS               (0x00004000)
-#define DEBUG_TRACE_FILEINFO                    (0x00008000)
-#define DEBUG_TRACE_DIRINFO                             (0x00010000)
-#define DEBUG_TRACE_REFERENCE                   (0x00020000)
-#define DEBUG_TRACE_FSCTRL                              (0x00040000)
-#define DEBUG_TRACE_FREE                                (0x00080000)
-#define DEBUG_TRACE_LINENO                  (0x00100000)
-#define DEBUG_TRACE_TRIPLE                  (0x00200000)
-
-#define DEBUG_TRACE_ALL                                         (0xffffffff)
-#define DEBUG_TRACE_NONE                                         0
-//
-//     The permitted DebugTrace types...
-//
-#define PERMITTED_DEBUG_TRACE_TYPES            DEBUG_TRACE_NONE
-/*
-#define PERMITTED_DEBUG_TRACE_TYPES            DEBUG_TRACE_ERROR | DEBUG_TRACE_IRP_ENTRY |             \
-                                                                               DEBUG_TRACE_FILE_NAME | DEBUG_TRACE_SPECIAL     |       \
-                                                                               DEBUG_TRACE_ASYNC
-
-*/
-
-
-#define DebugTrace( TYPE, X, Y )                                                                                       \
-{                                                                                                                                                      \
-       if( ( TYPE ) & ( PERMITTED_DEBUG_TRACE_TYPES ) )                                                \
-       {                                                                                                                                               \
-               if( ( DEBUG_TRACE_LINENO ) & ( PERMITTED_DEBUG_TRACE_TYPES ) )          \
-               {                                                                                                                                       \
-                       DbgPrint("(%s:%ld) ", __FILE__, __LINE__ );                                             \
-               }                                                                                                                                       \
-               DbgPrint(X,Y);                                                                                                          \
-               if( ( DEBUG_TRACE_IRQL ) & ( PERMITTED_DEBUG_TRACE_TYPES ) )            \
-               {                                                                                                                                       \
-                       DbgPrint( ",IRQL = %d ", KeGetCurrentIrql( ) );                                 \
-               }                                                                                                                                       \
-               DbgPrint("\n");                                                                                                         \
-       }                                                                                                                                               \
-}
-
-
-#define DebugTraceState( STR, X1, X2, X3)                                                                                                              \
-{                                                                                                                                                                                              \
-       if( ( DEBUG_TRACE_RESOURCE_STATE ) & ( PERMITTED_DEBUG_TRACE_TYPES ) )                                          \
-       {                                                                                                                                                                                       \
-               DbgPrint("\nState: ");                                                                                                                                  \
-               DbgPrint( STR, X1, X2, X3 );                                                                                                                    \
-               if( ( DEBUG_TRACE_IRQL ) & ( PERMITTED_DEBUG_TRACE_TYPES ) )                                                    \
-               {                                                                                                                                                                               \
-                       DbgPrint( "  IRQL = %d ", KeGetCurrentIrql( ) );                                                                        \
-               }                                                                                                                                                                               \
-       }                                                                                                                                                                                       \
-}
-
-#define AssertFCB( PtrFCB )                                                                                                            \
-{                                                                                                                                                              \
-       if( !(PtrFCB) || (PtrFCB)->NodeIdentifier.NodeType != EXT2_NODE_TYPE_FCB )      \
-       {                                                                                                                                                       \
-               Ext2BreakPoint();                                                                                                               \
-       }                                                                                                                                                       \
-}
-
-#define AssertVCB( PtrVCB )                                                                                                            \
-{                                                                                                                                                              \
-       if( !(PtrVCB) || (PtrVCB)->NodeIdentifier.NodeType != EXT2_NODE_TYPE_VCB )      \
-       {                                                                                                                                                       \
-               Ext2BreakPoint();                                                                                                               \
-       }                                                                                                                                                       \
-}
-
-#define AssertFCBorVCB( PtrVCBorFCB )                                                                                  \
-{                                                                                                                                                              \
-       if( !(PtrVCBorFCB) ||                                                                                                           \
-               ( (PtrVCBorFCB)->NodeIdentifier.NodeType != EXT2_NODE_TYPE_VCB &&               \
-                 (PtrVCBorFCB)->NodeIdentifier.NodeType != EXT2_NODE_TYPE_FCB ) )              \
-       {                                                                                                                                                       \
-               Ext2BreakPoint();                                                                                                               \
-       }                                                                                                                                                       \
-}
-
-#else
-       #define DebugTrace( TYPE, X, Y )
-       #define DebugTraceState( STR, X1, X2, X3 )
-       #define AssertFCB( PtrFCB )
-       #define AssertVCB( PtrVCB )
-       #define AssertFCBorVCB( PtrVCBorFCB )
-
-#endif
-
-#endif // _EXT2_FSD_H_
diff --git a/drivers/filesystems/ext2/inc/ext2metadata.h b/drivers/filesystems/ext2/inc/ext2metadata.h
deleted file mode 100644 (file)
index bbe240e..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*************************************************************************
-*
-* File: ext2metadata.h
-*
-* Module: Ext2 File System Driver (Kernel mode execution only)
-*
-* Description:
-*      Contains the definitions for the Ext2 Metadata structures.
-*
-* Author: Manoj Paul Joseph
-*
-*
-*************************************************************************/
-
-#ifndef EXT2_METADATA_STRUCTURES
-#define EXT2_METADATA_STRUCTURES
-
-//
-//     Some type definitions...
-//     These are used in the ext2_fs.h header file
-//
-typedef unsigned int           __u32 ;
-typedef signed int                     __s32 ;
-typedef unsigned short int     __u16 ;
-typedef signed short int       __s16 ;
-typedef unsigned char          __u8 ;
-
-//
-//******************************************************
-//
-//     Using Remy Card's (slightly modified) Ext2 header...
-//     
-#include "ext2_fs.h"
-//
-//******************************************************
-//
-
-typedef struct ext2_super_block        EXT2_SUPER_BLOCK;
-typedef EXT2_SUPER_BLOCK *             PEXT2_SUPER_BLOCK;
-
-typedef struct ext2_inode              EXT2_INODE;
-typedef EXT2_INODE *                   PEXT2_INODE;
-
-typedef struct ext2_group_desc EXT2_GROUP_DESCRIPTOR;
-typedef EXT2_GROUP_DESCRIPTOR *        PEXT2_GROUP_DESCRIPTOR;
-
-typedef struct ext2_dir_entry_2        EXT2_DIR_ENTRY;
-typedef EXT2_DIR_ENTRY *               PEXT2_DIR_ENTRY;
-
-//
-// Ext2 Supported File Types...
-//
-#define IMODE_FIFO            0x01
-#define IMODE_CHARDEV         0x02
-#define IMODE_DIR             0x04
-#define IMODE_BLOCKDEV        0x06
-#define IMODE_FILE            0x08
-#define IMODE_SLINK           0x0A
-#define IMODE_SOCKET          0x0C
-
-#define _MKMODE(m)                                      ( ( (m) >> 12 ) & 0x000F)
-#define Ext2IsModeRegularFile(m)        ( _MKMODE(m) == IMODE_FILE )
-#define Ext2IsModeDirectory(m)          ( _MKMODE(m) == IMODE_DIR   )
-#define Ext2IsModeSymbolicLink(m)       ( _MKMODE(m) == IMODE_SLINK )
-#define Ext2IsModePipe(m)                       ( _MKMODE(m) == IMODE_FIFO )
-#define Ext2IsModeCharacterDevice(m) ( _MKMODE(m) == IMODE_CHARDEV )
-#define Ext2IsModeBlockDevice(m)        ( _MKMODE(m) == IMODE_BLOCKDEV )
-#define Ext2IsModeSocket(m)                     ( _MKMODE(m) == IMODE_SOCKET )
-
-#define Ext2IsModeHidden(m)                    ( (m & 0x124) == 0)     //      No Read Permission
-#define Ext2IsModeReadOnly(m)          ( (m & 0x92) == 0)      //      No write Permission
-
-#define Ext2SetModeHidden(m)           m = (m & (~0x124));     //      Turn off Read Permission
-#define Ext2SetModeReadOnly(m)         m = (m & (~0x92));      //      Turn off write Permission
-#define Ext2SetModeReadWrite(m)                m = (m & 0x1ff);        //      Set read/write Permission
-
-
-//
-//  Define the Packed and Unpacked BIOS Parameter Block
-//
-typedef struct _PACKED_BIOS_PARAMETER_BLOCK {
-    UCHAR  BytesPerSector[2];                       // offset = 0x000  0
-    UCHAR  SectorsPerCluster[1];                    // offset = 0x002  2
-    UCHAR  ReservedSectors[2];                      // offset = 0x003  3
-    UCHAR  Fats[1];                                 // offset = 0x005  5
-    UCHAR  RootEntries[2];                          // offset = 0x006  6
-    UCHAR  Sectors[2];                              // offset = 0x008  8
-    UCHAR  Media[1];                                // offset = 0x00A 10
-    UCHAR  SectorsPerFat[2];                        // offset = 0x00B 11
-    UCHAR  SectorsPerTrack[2];                      // offset = 0x00D 13
-    UCHAR  Heads[2];                                // offset = 0x00F 15
-    UCHAR  HiddenSectors[4];                        // offset = 0x011 17
-    UCHAR  LargeSectors[4];                         // offset = 0x015 21
-} PACKED_BIOS_PARAMETER_BLOCK;                      // sizeof = 0x019 25
-typedef PACKED_BIOS_PARAMETER_BLOCK *PPACKED_BIOS_PARAMETER_BLOCK;
-
-//
-//  Define the boot sector
-//
-typedef struct _PACKED_BOOT_SECTOR {
-    UCHAR Jump[3];                                  // offset = 0x000   0
-    UCHAR Oem[8];                                   // offset = 0x003   3
-    PACKED_BIOS_PARAMETER_BLOCK PackedBpb;          // offset = 0x00B  11
-    UCHAR PhysicalDriveNumber;                      // offset = 0x024  36
-    UCHAR CurrentHead;                              // offset = 0x025  37
-    UCHAR Signature;                                // offset = 0x026  38
-    UCHAR Id[4];                                    // offset = 0x027  39
-    UCHAR VolumeLabel[11];                          // offset = 0x02B  43
-    UCHAR SystemId[8];                              // offset = 0x036  54
-} PACKED_BOOT_SECTOR;                               // sizeof = 0x03E  62
-
-typedef PACKED_BOOT_SECTOR *PPACKED_BOOT_SECTOR;
-
-
-#endif
diff --git a/drivers/filesystems/ext2/inc/protos.h b/drivers/filesystems/ext2/inc/protos.h
deleted file mode 100644 (file)
index 864dfc2..0000000
+++ /dev/null
@@ -1,782 +0,0 @@
-/*************************************************************************
-*
-* File: protos.h
-*
-* Module: Ext2 File System Driver (Kernel mode execution only)
-*
-* Description:
-*      Contains the prototypes for functions in this sample FSD.
-*
-* Author: Manoj Paul Joseph
-*
-*
-*************************************************************************/
-
-#ifndef        _EXT2_PROTOS_H_
-#define        _EXT2_PROTOS_H_
-
-#ifdef __REACTOS__
-typedef PIO_STACK_LOCATION PEXTENDED_IO_STACK_LOCATION;
-#endif
-
-/*************************************************************************
-* Prototypes for the file sfsdinit.c
-*************************************************************************/
-extern NTSTATUS NTAPI DriverEntry(
-       PDRIVER_OBJECT                  DriverObject,           // created by the I/O sub-system
-       PUNICODE_STRING                 RegistryPath);          // path to the registry key
-
-extern void NTAPI Ext2FsdInitializeFunctionPointers(
-       PDRIVER_OBJECT                  DriverObject);          // created by the I/O sub-system
-
-
-extern VOID NTAPI Ext2QueueHandlerThread(
-       IN PVOID                                StartContext);
-                                                                                               
-/*************************************************************************
-* Prototypes for the file fsctrl.c
-*************************************************************************/
-
-extern NTSTATUS NTAPI Ext2FileSystemControl(
-    IN PDEVICE_OBJECT          DeviceObject,
-    IN PIRP                                    Irp
-    );
-
-extern NTSTATUS NTAPI Ext2VerifyVolume (
-       IN PIRP                                 Irp,
-       IN PIO_STACK_LOCATION   IrpSp );
-
-
-/*************************************************************************
-* Prototypes for the file create.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2Create(
-PDEVICE_OBJECT                         DeviceObject,           // the logical volume device object
-PIRP                                           Irp);                   // I/O Request Packet
-
-extern NTSTATUS NTAPI Ext2CommonCreate(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                           PtrIrp,
-BOOLEAN                                                FirstAttempt );
-
-extern NTSTATUS NTAPI Ext2OpenVolume(
-       PtrExt2VCB                              PtrVCB,                         // volume to be opened
-       PtrExt2IrpContext               PtrIrpContext,          // IRP context
-       PIRP                                    PtrIrp,                         // original/user IRP
-       unsigned short                  ShareAccess,            // share access
-       PIO_SECURITY_CONTEXT    PtrSecurityContext,     // caller's context (incl access)
-       PFILE_OBJECT                    PtrNewFileObject);      // I/O Mgr. created file object
-
-extern NTSTATUS NTAPI Ext2OpenRootDirectory(
-       PtrExt2VCB                              PtrVCB,                                 // volume to be opened
-       PtrExt2IrpContext               PtrIrpContext,                  // IRP context
-       PIRP                                    PtrIrp,                                 // original/user IRP
-       unsigned short                  ShareAccess,                    // share access
-       PIO_SECURITY_CONTEXT    PtrSecurityContext,             // caller's context (incl access)
-       PFILE_OBJECT                    PtrNewFileObject);              // I/O Mgr. created file object
-
-extern void NTAPI Ext2InitializeFCB(
-       PtrExt2FCB                              PtrNewFCB,              // FCB structure to be initialized
-       PtrExt2VCB                              PtrVCB,                 // logical volume (VCB) pointer
-       PtrExt2ObjectName               PtrObjectName,  // name of the object
-       uint32                                  Flags,                  // is this a file/directory, etc.
-       PFILE_OBJECT                    PtrFileObject);// optional file object to be initialized
-
-extern PtrExt2FCB      NTAPI Ext2LocateChildFCBInCore(
-       PtrExt2VCB                              PtrVCB, 
-       PUNICODE_STRING                 PtrName, 
-       ULONG                                   ParentInodeNo );
-
-extern PtrExt2FCB      NTAPI Ext2LocateFCBInCore(
-       PtrExt2VCB                              PtrVCB, 
-       ULONG                                   InodeNo );
-
-
-extern ULONG   NTAPI Ext2LocateFileInDisk(
-       PtrExt2VCB                              PtrVCB,
-       PUNICODE_STRING                 PtrCurrentName, 
-       PtrExt2FCB                              PtrParentFCB, 
-       ULONG                                   *Type );
-
-extern ULONG NTAPI Ext2CreateFile(
-       PtrExt2IrpContext               PtrIrpContext,
-       PtrExt2VCB                              PtrVCB,
-       PUNICODE_STRING                 PtrName, 
-       PtrExt2FCB                              PtrParentFCB,
-       ULONG                                   Type);
-
-extern BOOLEAN NTAPI Ext2OverwriteFile(
-       PtrExt2FCB                              PtrFCB,
-       PtrExt2IrpContext               PtrIrpContext);
-
-extern BOOLEAN NTAPI Ext2SupersedeFile(
-       PtrExt2FCB                              PtrFCB,
-       PtrExt2IrpContext               PtrIrpContext);
-
-/*************************************************************************
-* Prototypes for the file misc.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2InitializeZones(
-void);
-
-extern void NTAPI Ext2DestroyZones(
-void);
-
-extern BOOLEAN NTAPI Ext2IsIrpTopLevel(
-PIRP                                                   Irp);                                   // the IRP sent to our dispatch routine
-
-extern long NTAPI Ext2ExceptionFilter(
-PtrExt2IrpContext                      PtrIrpContext,
-PEXCEPTION_POINTERS            PtrExceptionPointers);
-
-extern NTSTATUS NTAPI Ext2ExceptionHandler(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                                   Irp);
-
-extern void NTAPI Ext2LogEvent(
-NTSTATUS                                               Ext2EventLogId, // the Ext2 private message id
-NTSTATUS                                               RC);                                    // any NT error code we wish to log ...
-
-extern PtrExt2ObjectName NTAPI Ext2AllocateObjectName(
-void);
-
-extern void NTAPI Ext2ReleaseObjectName(
-PtrExt2ObjectName                      PtrObjectName);
-
-extern PtrExt2CCB NTAPI Ext2AllocateCCB(
-void );
-
-extern PtrExt2FCB NTAPI Ext2GetUsedFCB( 
-PtrExt2VCB                                     PtrVCB );
-
-extern BOOLEAN NTAPI Ext2CloseClosableFCB( 
-PtrExt2FCB                                     PtrFCB );
-
-extern void NTAPI Ext2ReleaseCCB(
-PtrExt2CCB                                     PtrCCB);
-
-extern PtrExt2FCB NTAPI Ext2AllocateFCB(
-void);
-
-extern NTSTATUS NTAPI Ext2CreateNewFCB(
-PtrExt2FCB                                     *ReturnedFCB,
-LARGE_INTEGER                          AllocationSize,
-LARGE_INTEGER                          EndOfFile,
-PFILE_OBJECT                           PtrFileObject,
-PtrExt2VCB                                     PtrVCB,
-PtrExt2ObjectName                      PtrObjectName);
-
-extern NTSTATUS NTAPI Ext2CreateNewCCB(
-PtrExt2CCB                             *ReturnedCCB,
-PtrExt2FCB                             PtrFCB,
-PFILE_OBJECT                   PtrFileObject);
-
-extern void NTAPI Ext2ReleaseFCB(
-PtrExt2FCB                                     PtrFCB);
-
-extern PtrExt2FileLockInfo NTAPI Ext2AllocateByteLocks(
-void);
-
-extern void NTAPI Ext2ReleaseByteLocks(
-PtrExt2FileLockInfo            PtrByteLocks);
-
-extern PtrExt2IrpContext NTAPI Ext2AllocateIrpContext(
-PIRP                                                   Irp,
-PDEVICE_OBJECT                         PtrTargetDeviceObject);
-
-extern void NTAPI Ext2ReleaseIrpContext(
-PtrExt2IrpContext                      PtrIrpContext);
-
-extern NTSTATUS NTAPI Ext2PostRequest(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                           PtrIrp);
-
-extern void NTAPI Ext2CommonDispatch(
-void                                           *Context);      // actually an IRPContext structure
-
-extern void NTAPI Ext2InitializeVCB(
-PDEVICE_OBJECT                         PtrVolumeDeviceObject,
-PDEVICE_OBJECT                         PtrTargetDeviceObject,
-PVPB                                           PtrVPB,
-PLARGE_INTEGER                         AllocationSize);
-
-extern void NTAPI Ext2CompleteRequest(
-    IN PIRP                                    Irp OPTIONAL,
-    IN NTSTATUS                                Status
-    );
-
-extern NTSTATUS NTAPI Ext2DenyAccess( 
-       IN PIRP Irp 
-       );
-extern NTSTATUS NTAPI Ext2GetFCB_CCB_VCB_FromFileObject(
-       IN PFILE_OBJECT                 PtrFileObject,
-       OUT PtrExt2FCB                          *PPtrFCB,
-       OUT PtrExt2CCB                          *PPtrCCB,
-       OUT PtrExt2VCB                          *PPtrVCB        );
-
-extern void NTAPI Ext2CopyUnicodeString( 
-       IN OUT PUNICODE_STRING  PtrDestinationString, 
-       IN PUNICODE_STRING PtrSourceString );
-
-extern void NTAPI Ext2CopyWideCharToUnicodeString( 
-       IN OUT PUNICODE_STRING  PtrDestinationString, 
-       IN PCWSTR PtrSourceString );
-
-extern void NTAPI Ext2CopyCharToUnicodeString( 
-       IN OUT PUNICODE_STRING  PtrDestinationString, 
-       IN PCSTR PtrSourceString,
-       IN USHORT SourceStringLength );
-
-extern void NTAPI Ext2CopyZCharToUnicodeString( 
-       IN OUT PUNICODE_STRING  PtrDestinationString, 
-       IN PCSTR PtrSourceString );
-
-extern void NTAPI Ext2DeallocateUnicodeString( 
-       PUNICODE_STRING         PtrUnicodeString );
-
-extern void NTAPI Ext2ZerooutUnicodeString(
-       PUNICODE_STRING         PtrUnicodeString );
-
-extern BOOLEAN NTAPI Ext2SaveBCB(
-       PtrExt2IrpContext       PtrIrpContext,
-       PBCB                            PtrBCB,
-       PFILE_OBJECT            PtrFileObject);
-
-extern BOOLEAN NTAPI Ext2FlushSavedBCBs(
-       PtrExt2IrpContext       PtrIrpContext);
-
-extern BOOLEAN NTAPI AssertBCB(
-       PBCB                            PtrBCB);
-
-extern ULONG NTAPI Ext2Align(
-       ULONG                           NumberToBeAligned, 
-       ULONG                           Alignment);
-
-extern LONGLONG NTAPI Ext2Align64(
-       LONGLONG                        NumberToBeAligned, 
-       LONGLONG                        Alignment);
-
-extern ULONG NTAPI Ext2GetCurrentTime(VOID);
-
-/*************************************************************************
-* Prototypes for the file cleanup.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2Cleanup(
-PDEVICE_OBJECT                         DeviceObject,           // the logical volume device object
-PIRP                                                   Irp);                                   // I/O Request Packet
-
-extern NTSTATUS        NTAPI Ext2CommonCleanup(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                           PtrIrp,
-BOOLEAN                                                FirstAttempt );
-
-/*************************************************************************
-* Prototypes for the file close.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2Close(
-PDEVICE_OBJECT                         DeviceObject,           // the logical volume device object
-PIRP                                                   Irp);                                   // I/O Request Packet
-
-extern NTSTATUS        NTAPI Ext2CommonClose(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                           PtrIrp,
-BOOLEAN                                                FirstAttempt );
-
-/*************************************************************************
-* Prototypes for the file read.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2Read(
-PDEVICE_OBJECT                         DeviceObject,           // the logical volume device object
-PIRP                                                   Irp);                                   // I/O Request Packet
-
-extern NTSTATUS        NTAPI Ext2CommonRead(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                   PtrIrp,
-BOOLEAN                                                FirstAttempt );
-
-extern void * NTAPI Ext2GetCallersBuffer(
-PIRP                                           PtrIrp);
-
-extern NTSTATUS NTAPI Ext2LockCallersBuffer(
-PIRP                                           PtrIrp,
-BOOLEAN                                                IsReadOperation,
-uint32                                         Length);
-
-extern void NTAPI Ext2MdlComplete(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                           PtrIrp,
-PIO_STACK_LOCATION                     PtrIoStackLocation,
-BOOLEAN                                                ReadCompletion);
-
-/*************************************************************************
-* Prototypes for the file write.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2Write(
-PDEVICE_OBJECT                         DeviceObject,           // the logical volume device object
-PIRP                                                   Irp);                                   // I/O Request Packet
-
-extern NTSTATUS        NTAPI Ext2CommonWrite(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                   PtrIrp);
-
-extern void NTAPI Ext2DeferredWriteCallBack (
-void                                                   *Context1,                      // Should be PtrIrpContext
-void                                                   *Context2);                     // Should be PtrIrp
-
-/*************************************************************************
-* Prototypes for the file fileinfo.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2FileInfo(
-PDEVICE_OBJECT                         DeviceObject,           // the logical volume device object
-PIRP                                           Irp);                                   // I/O Request Packet
-
-extern NTSTATUS        NTAPI Ext2CommonFileInfo(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                           PtrIrp);
-
-extern NTSTATUS        NTAPI Ext2GetBasicInformation(
-       PtrExt2FCB                                      PtrFCB,
-       PFILE_BASIC_INFORMATION         PtrBuffer,
-       long                                            *PtrReturnedLength);
-
-extern NTSTATUS        NTAPI Ext2GetStandardInformation(
-       PtrExt2FCB                                      PtrFCB,
-       PFILE_STANDARD_INFORMATION      PtrStdInformation,
-       long                                            *PtrReturnedLength);
-
-extern NTSTATUS NTAPI Ext2GetNetworkOpenInformation(
-       PtrExt2FCB                                              PtrFCB,
-       PFILE_NETWORK_OPEN_INFORMATION  PtrNetworkOpenInformation,
-       long                                                    *PtrReturnedLength );
-
-extern NTSTATUS        NTAPI Ext2GetFullNameInformation(
-       PtrExt2FCB                              PtrFCB,
-       PtrExt2CCB                              PtrCCB,
-       PFILE_NAME_INFORMATION  PtrNameInformation,
-       long                                    *PtrReturnedLength);
-
-extern NTSTATUS        NTAPI Ext2SetBasicInformation(
-       PtrExt2IrpContext                       PtrIrpContext,
-       PtrExt2FCB                                      PtrFCB,
-       PFILE_OBJECT                            PtrFileObject,
-       PFILE_BASIC_INFORMATION         PtrFileInformation );
-
-extern NTSTATUS        NTAPI Ext2SetDispositionInformation(
-PtrExt2FCB                                     PtrFCB,
-PtrExt2CCB                                     PtrCCB,
-PtrExt2VCB                                     PtrVCB,
-PFILE_OBJECT                           PtrFileObject,
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                                   PtrIrp,
-PFILE_DISPOSITION_INFORMATION  PtrBuffer);
-
-extern NTSTATUS        NTAPI Ext2SetAllocationInformation(
-PtrExt2FCB                                     PtrFCB,
-PtrExt2CCB                                     PtrCCB,
-PtrExt2VCB                                     PtrVCB,
-PFILE_OBJECT                           PtrFileObject,
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                                   PtrIrp,
-PFILE_ALLOCATION_INFORMATION   PtrBuffer);
-
-/*************************************************************************
-* Prototypes for the file flush.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2Flush(
-PDEVICE_OBJECT                         DeviceObject,           // the logical volume device object
-PIRP                                                   Irp);                                   // I/O Request Packet
-
-extern NTSTATUS        NTAPI Ext2CommonFlush(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                                   PtrIrp);
-
-extern void NTAPI Ext2FlushAFile(
-PtrExt2NTRequiredFCB           PtrReqdFCB,
-PIO_STATUS_BLOCK                       PtrIoStatus);
-
-extern void NTAPI Ext2FlushLogicalVolume(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                                   PtrIrp,
-PtrExt2VCB                                     PtrVCB);
-
-extern NTSTATUS NTAPI Ext2FlushCompletion(
-PDEVICE_OBJECT                         PtrDeviceObject,
-PIRP                                                   PtrIrp,
-PVOID                                                  Context);
-
-/*************************************************************************
-* Prototypes for the file dircntrl.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2DirControl(
-PDEVICE_OBJECT                         DeviceObject,           // the logical volume device object
-PIRP                                                   Irp);                                   // I/O Request Packet
-
-extern NTSTATUS        NTAPI Ext2CommonDirControl(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                                   PtrIrp);
-
-extern NTSTATUS        NTAPI Ext2QueryDirectory(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                           PtrIrp,
-PEXTENDED_IO_STACK_LOCATION                    PtrIoStackLocation,
-PFILE_OBJECT                           PtrFileObject,
-PtrExt2FCB                                     PtrFCB,
-PtrExt2CCB                                     PtrCCB);
-
-extern NTSTATUS        NTAPI Ext2NotifyChangeDirectory(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                           PtrIrp,
-PEXTENDED_IO_STACK_LOCATION            PtrIoStackLocation,
-PFILE_OBJECT                           PtrFileObject,
-PtrExt2FCB                                     PtrFCB,
-PtrExt2CCB                                     PtrCCB);
-
-/*************************************************************************
-* Prototypes for the file devcntrl.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2DeviceControl(
-PDEVICE_OBJECT                         DeviceObject,           // the logical volume device object
-PIRP                                           Irp);                                   // I/O Request Packet
-
-extern NTSTATUS NTAPI Ext2CommonDeviceControl(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                           PtrIrp);
-
-extern NTSTATUS NTAPI Ext2DevIoctlCompletion(
-PDEVICE_OBJECT                         PtrDeviceObject,
-PIRP                                           PtrIrp,
-void                                           *Context);
-
-extern NTSTATUS NTAPI Ext2HandleQueryPath(
-void                                           *BufferPointer);
-
-/*************************************************************************
-* Prototypes for the file shutdown.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2Shutdown(
-PDEVICE_OBJECT                         DeviceObject,           // the logical volume device object
-PIRP                                           Irp);                   // I/O Request Packet
-
-extern NTSTATUS        NTAPI Ext2CommonShutdown(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                           PtrIrp);
-
-/*************************************************************************
-* Prototypes for the file volinfo.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2QueryVolInfo(
-PDEVICE_OBJECT                         DeviceObject,   // the logical volume device object
-PIRP                                           Irp);                   // I/O Request Packet
-
-NTSTATUS NTAPI Ext2SetVolInfo(
-       IN PDEVICE_OBJECT               DeviceObject,   // the logical volume device object
-       IN PIRP                                 Irp);                   // I/O Request Packet
-
-
-/*************************************************************************
-* Prototypes for the file fastio.c
-*************************************************************************/
-extern BOOLEAN NTAPI Ext2FastIoCheckIfPossible(
-IN PFILE_OBJECT                                FileObject,
-IN PLARGE_INTEGER                              FileOffset,
-IN ULONG                                                       Length,
-IN BOOLEAN                                             Wait,
-IN ULONG                                                       LockKey,
-IN BOOLEAN                                             CheckForReadOperation,
-OUT PIO_STATUS_BLOCK                   IoStatus,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern BOOLEAN NTAPI Ext2FastIoRead(
-IN PFILE_OBJECT                                FileObject,
-IN PLARGE_INTEGER                              FileOffset,
-IN ULONG                                                       Length,
-IN BOOLEAN                                             Wait,
-IN ULONG                                                       LockKey,
-OUT PVOID                                              Buffer,
-OUT PIO_STATUS_BLOCK                   IoStatus,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern BOOLEAN NTAPI Ext2FastIoWrite(
-IN PFILE_OBJECT                                FileObject,
-IN PLARGE_INTEGER                              FileOffset,
-IN ULONG                                                       Length,
-IN BOOLEAN                                             Wait,
-IN ULONG                                                       LockKey,
-OUT PVOID                                              Buffer,
-OUT PIO_STATUS_BLOCK                   IoStatus,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern BOOLEAN NTAPI Ext2FastIoQueryBasicInfo(
-IN PFILE_OBJECT                                        FileObject,
-IN BOOLEAN                                                     Wait,
-OUT PFILE_BASIC_INFORMATION    Buffer,
-OUT PIO_STATUS_BLOCK                   IoStatus,
-IN PDEVICE_OBJECT                                      DeviceObject);
-
-extern BOOLEAN NTAPI Ext2FastIoQueryStdInfo(
-IN PFILE_OBJECT                                                FileObject,
-IN BOOLEAN                                                             Wait,
-OUT PFILE_STANDARD_INFORMATION         Buffer,
-OUT PIO_STATUS_BLOCK                           IoStatus,
-IN PDEVICE_OBJECT                                              DeviceObject);
-
-extern BOOLEAN NTAPI Ext2FastIoLock(
-IN PFILE_OBJECT                                FileObject,
-IN PLARGE_INTEGER                              FileOffset,
-IN PLARGE_INTEGER                              Length,
-PEPROCESS                                              ProcessId,
-ULONG                                                          Key,
-BOOLEAN                                                        FailImmediately,
-BOOLEAN                                                        ExclusiveLock,
-OUT PIO_STATUS_BLOCK                   IoStatus,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern BOOLEAN NTAPI Ext2FastIoUnlockSingle(
-IN PFILE_OBJECT                                FileObject,
-IN PLARGE_INTEGER                              FileOffset,
-IN PLARGE_INTEGER                              Length,
-PEPROCESS                                              ProcessId,
-ULONG                                                          Key,
-OUT PIO_STATUS_BLOCK                   IoStatus,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern BOOLEAN NTAPI Ext2FastIoUnlockAll(
-IN PFILE_OBJECT                                FileObject,
-PEPROCESS                                              ProcessId,
-OUT PIO_STATUS_BLOCK                   IoStatus,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern BOOLEAN NTAPI Ext2FastIoUnlockAllByKey(
-IN PFILE_OBJECT                                FileObject,
-PVOID                                          ProcessId,
-ULONG                                                          Key,
-OUT PIO_STATUS_BLOCK                   IoStatus,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern void NTAPI Ext2FastIoAcqCreateSec(
-IN PFILE_OBJECT                                FileObject);
-
-extern void NTAPI Ext2FastIoRelCreateSec(
-IN PFILE_OBJECT                                FileObject);
-
-extern BOOLEAN NTAPI Ext2AcqLazyWrite(
-IN PVOID                                                       Context,
-IN BOOLEAN                                             Wait);
-
-extern void NTAPI Ext2RelLazyWrite(
-IN PVOID                                                       Context);
-
-extern BOOLEAN NTAPI Ext2AcqReadAhead(
-IN PVOID                                                       Context,
-IN BOOLEAN                                             Wait);
-
-extern void NTAPI Ext2RelReadAhead(
-IN PVOID                                                       Context);
-
-// the remaining are only valid under NT Version 4.0 and later
-#if(_WIN32_WINNT >= 0x0400)
-
-extern BOOLEAN NTAPI Ext2FastIoQueryNetInfo(
-IN PFILE_OBJECT                                                                        FileObject,
-IN BOOLEAN                                                                                     Wait,
-OUT PFILE_NETWORK_OPEN_INFORMATION                     Buffer,
-OUT PIO_STATUS_BLOCK                                                   IoStatus,
-IN PDEVICE_OBJECT                                                                      DeviceObject);
-
-extern BOOLEAN NTAPI Ext2FastIoMdlRead(
-IN PFILE_OBJECT                                FileObject,
-IN PLARGE_INTEGER                              FileOffset,
-IN ULONG                                                       Length,
-IN ULONG                                                       LockKey,
-OUT PMDL                                                       *MdlChain,
-OUT PIO_STATUS_BLOCK                   IoStatus,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern BOOLEAN NTAPI Ext2FastIoMdlReadComplete(
-IN PFILE_OBJECT                                FileObject,
-OUT PMDL                                                       MdlChain,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern BOOLEAN NTAPI Ext2FastIoPrepareMdlWrite(
-IN PFILE_OBJECT                                FileObject,
-IN PLARGE_INTEGER                              FileOffset,
-IN ULONG                                                       Length,
-IN ULONG                                                       LockKey,
-OUT PMDL                                                       *MdlChain,
-OUT PIO_STATUS_BLOCK                   IoStatus,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern BOOLEAN NTAPI Ext2FastIoMdlWriteComplete(
-IN PFILE_OBJECT                                FileObject,
-IN PLARGE_INTEGER                              FileOffset,
-OUT PMDL                                                       MdlChain,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern NTSTATUS NTAPI Ext2FastIoAcqModWrite(
-IN PFILE_OBJECT                                FileObject,
-IN PLARGE_INTEGER                              EndingOffset,
-OUT PERESOURCE                                 *ResourceToRelease,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern NTSTATUS NTAPI Ext2FastIoRelModWrite(
-IN PFILE_OBJECT                                FileObject,
-IN PERESOURCE                                  ResourceToRelease,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern NTSTATUS NTAPI Ext2FastIoAcqCcFlush(
-IN PFILE_OBJECT                                FileObject,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-extern NTSTATUS NTAPI Ext2FastIoRelCcFlush(
-IN PFILE_OBJECT                                FileObject,
-IN PDEVICE_OBJECT                              DeviceObject);
-
-#endif // (_WIN32_WINNT >= 0x0400)
-
-/*************************************************************************
-* Prototypes for the file DiskIO.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2ReadLogicalBlocks(
-PDEVICE_OBJECT         PtrTargetDeviceObject,  //      the Target Device Object
-VOID                           *Buffer,                                //      The Buffer that takes the data read in
-LARGE_INTEGER          StartLogicalBlock,              //      The logical block from which reading is to start
-unsigned int           NoOfLogicalBlocks);             //      The no. of logical blocks to be read
-
-extern NTSTATUS NTAPI Ext2ReadPhysicalBlocks(
-       PDEVICE_OBJECT          PtrTargetDeviceObject,  //      the Target Device Object
-       VOID                            *Buffer,                                //      The Buffer that takes the data read in
-       LARGE_INTEGER           StartBlock,             //      The Physical block from which reading is to start
-       unsigned int            NoOfBlocks);            //      The no. of Physical blocks to be read
-
-/*************************************************************************
-* Prototypes for the file metadata.c
-*************************************************************************/
-
-extern void NTAPI Ext2InitializeFCBInodeInfo (
-       PtrExt2FCB      PtrFCB );
-
-extern NTSTATUS NTAPI Ext2ReadInode(
-       PtrExt2VCB                      PtrVcb,                 //      the Volume Control Block
-       uint32                          InodeNo,                //      The Inode no
-       PEXT2_INODE                     PtrInode );             //      The Inode Buffer
-
-extern NTSTATUS NTAPI Ext2WriteInode(
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2VCB                      PtrVcb,                 //      the Volume Control Block
-       uint32                          InodeNo,                //      The Inode no
-       PEXT2_INODE                     PtrInode                //      The Inode Buffer
-       );                                      
-
-extern ULONG NTAPI Ext2AllocInode( 
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2VCB                      PtrVCB,
-       ULONG                           ParentINodeNo );
-
-extern BOOLEAN NTAPI Ext2DeallocInode( 
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2VCB                      PtrVCB,
-       ULONG                           INodeNo );
-
-extern BOOLEAN NTAPI Ext2MakeNewDirectoryEntry( 
-       PtrExt2IrpContext       PtrIrpContext,          //      The Irp context
-       PtrExt2FCB                      PtrParentFCB,           //      Parent Folder FCB
-       PFILE_OBJECT            PtrFileObject,          //      Parent Folder Object
-       PUNICODE_STRING         PtrName,                        //      New entry's name
-       ULONG                           Type,                           //      The type of the new entry
-       ULONG                           NewInodeNo);            //      The inode no of the new entry...
-
-extern BOOLEAN NTAPI Ext2FreeDirectoryEntry(
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2FCB                      PtrParentFCB,
-       PUNICODE_STRING         PtrName);
-
-extern BOOLEAN NTAPI Ext2AddBlockToFile(
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2VCB                      PtrVCB,
-       PtrExt2FCB                      PtrFCB,
-       PFILE_OBJECT            PtrFileObject,
-       BOOLEAN                         UpdateFileSize);
-
-extern BOOLEAN NTAPI Ext2ReleaseDataBlocks(
-       PtrExt2FCB                      PtrFCB,
-       PtrExt2IrpContext       PtrIrpContext);
-
-extern BOOLEAN NTAPI Ext2TruncateFileAllocationSize(
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2FCB                      PtrFCB,
-       PFILE_OBJECT            PtrFileObject,
-       PLARGE_INTEGER          PtrAllocationSize );
-
-extern ULONG NTAPI Ext2AllocBlock( 
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2VCB                      PtrVCB,
-       ULONG                           Count);
-
-extern BOOLEAN NTAPI Ext2DeallocBlock( 
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2VCB                      PtrVCB,
-       ULONG                           BlockNo);
-
-extern BOOLEAN NTAPI Ext2UpdateFileSize(
-       PtrExt2IrpContext       PtrIrpContext,
-       PFILE_OBJECT            PtrFileObject,
-       PtrExt2FCB                      PtrFCB);
-
-
-extern BOOLEAN NTAPI Ext2DeleteFile(
-       PtrExt2FCB                      PtrFCB,
-       PtrExt2IrpContext       PtrIrpContext);
-
-extern BOOLEAN NTAPI Ext2IsDirectoryEmpty(
-       PtrExt2FCB                      PtrFCB,
-       PtrExt2CCB                      PtrCCB,
-       PtrExt2IrpContext       PtrIrpContext);
-
-extern NTSTATUS NTAPI Ext2RenameOrLinkFile( 
-       PtrExt2FCB                                      PtrSourceFCB, 
-       PFILE_OBJECT                            PtrSourceFileObject,    
-       PtrExt2IrpContext                       PtrIrpContext,
-       PIRP                                            PtrIrp, 
-       PFILE_RENAME_INFORMATION        PtrRenameInfo);
-/*************************************************************************
-* Prototypes for the file io.c
-*************************************************************************/
-extern NTSTATUS NTAPI Ext2PassDownSingleReadWriteIRP(
-       PtrExt2IrpContext       PtrIrpContext,
-       PIRP                            PtrIrp, 
-       PtrExt2VCB                      PtrVCB,
-       LARGE_INTEGER           ByteOffset, 
-       uint32                          ReadWriteLength, 
-       BOOLEAN                         SynchronousIo);
-
-extern NTSTATUS NTAPI Ext2PassDownMultiReadWriteIRP( 
-       PEXT2_IO_RUN                    PtrIoRuns, 
-       UINT                                    Count, 
-       ULONG                                   TotalReadWriteLength,
-       PtrExt2IrpContext               PtrIrpContext,
-       PtrExt2FCB                              PtrFCB,
-       BOOLEAN                                 SynchronousIo);
-
-extern NTSTATUS NTAPI Ext2SingleSyncCompletionRoutine(
-    IN PDEVICE_OBJECT DeviceObject,
-    IN PIRP Irp,
-    IN PVOID Contxt
-    );
-
-extern NTSTATUS NTAPI Ext2SingleAsyncCompletionRoutine (
-    IN PDEVICE_OBJECT DeviceObject,
-    IN PIRP Irp,
-    IN PVOID Contxt
-    );
-
-extern NTSTATUS NTAPI Ext2MultiSyncCompletionRoutine(
-    IN PDEVICE_OBJECT DeviceObject,
-    IN PIRP Irp,
-    IN PVOID Contxt);
-
-extern NTSTATUS NTAPI Ext2MultiAsyncCompletionRoutine(
-    IN PDEVICE_OBJECT DeviceObject,
-    IN PIRP Irp,
-    IN PVOID Contxt);
-
-#endif // _EXT2_PROTOS_H_
diff --git a/drivers/filesystems/ext2/inc/struct.h b/drivers/filesystems/ext2/inc/struct.h
deleted file mode 100644 (file)
index 22eeed8..0000000
+++ /dev/null
@@ -1,684 +0,0 @@
-/*************************************************************************
-*
-* File: struct.h
-*
-* Module: Ext2 File System Driver (Kernel mode execution only)
-*
-* Description:
-*      This file contains structure definitions for the sample file system
-*      driver. Note that all structures are prefixed with the letters
-*      "Ext2". The structures are all aligned using normal alignment
-*      used by the compiler (typically quad-word aligned).
-*
-* Author: Manoj Paul Joseph
-*
-*
-*************************************************************************/
-
-#ifndef        _EXT2_STRUCTURES_H_
-#define        _EXT2_STRUCTURES_H_
-
-/**************************************************************************
-       some useful definitions
-**************************************************************************/
-typedef CHAR int8;
-typedef SHORT int16;
-typedef LONG int32;
-
-typedef UCHAR uint8;
-typedef USHORT uint16;
-typedef ULONG uint32;
-
-typedef PVOID PBCB;
-
-//
-// This is a huge hack that will create a broken driver for GCC.
-// The driver should use PSEH2.
-//
-#ifdef _MSC_VER
-#define try __try
-#define except __except
-#define finally __finally
-#else
-#define try if (1)
-#define except(x) if (0 && (x))
-#define finally if (1)
-#define GetExceptionInformation() 0
-#define GetExceptionCode() 0
-#endif
-
-// we will use the LARGE_INTEGER structure as defined by NT
-
-/**************************************************************************
-       some empty typedefs defined here so we can reference them easily
-**************************************************************************/
-struct _Ext2Identifier;
-struct _Ext2ObjectName;
-struct _Ext2ContextControlBlock;
-struct _Ext2NTRequiredFCB;
-struct _Ext2DiskDependentFCB;
-struct _Ext2FileControlBlock;
-struct _Ext2FileByteLocks;
-struct _Ext2VolumeControlBlock;
-struct _Ext2IrpContext;
-struct _Ext2Data;
-
-/**************************************************************************
-       each structure has a unique "node type" or signature associated with it
-**************************************************************************/
-#define        EXT2_NODE_TYPE_OBJECT_NAME                      (0xfdecba01)
-#define        EXT2_NODE_TYPE_CCB                                      (0xfdecba02)
-#define        EXT2_NODE_TYPE_FCB                                      (0xfdecba03)
-#define        EXT2_NODE_TYPE_LOCKS                            (0xfdecba04)
-#define        EXT2_NODE_TYPE_VCB                                      (0xfdecba05)
-#define        EXT2_NODE_TYPE_IRP_CONTEXT                      (0xfdecba06)
-#define        EXT2_NODE_TYPE_GLOBAL_DATA                      (0xfdecba07)
-#define        EXT2_NODE_TYPE_IO_CONTEXT                       (0xfdecba08)
-#define        EXT2_NODE_TYPE_SAVED_BCB                        (0xfdecba09)
-#define        EXT2_NODE_TYPE_FREED                            (0x10101010)
-#define        EXT2_NODE_TYPE_INVALID                          (0x10101010)
-
-/**************************************************************************
-       every structure has a node type, and a node size associated with it.
-       The node type serves as a signature field. The size is used for
-       consistency checking ...
-**************************************************************************/
-typedef struct _Ext2Identifier {
-       uint32          NodeType;                       // a 32 bit identifier for the structure
-       uint32          NodeSize;                       // computed as sizeof(structure)
-} Ext2Identifier, *PtrExt2Identifier;
-
-/**************************************************************************
-       Structures for byte-range lock support.
-**************************************************************************/
-typedef struct Ext2FileLockAnchor {
-       LIST_ENTRY                      GrantedFileLockList;
-       LIST_ENTRY                      PendingFileLockList;
-} Ext2FileLockAnchor, *PtrExt2FileLockAnchor;
-
-typedef struct Ext2FileLockInfo {
-       Ext2Identifier                                          NodeIdentifier;
-       uint32                                                          FileLockFlags;
-       PVOID                                                                   OwningProcess;
-       LARGE_INTEGER                                           StartingOffset;
-       LARGE_INTEGER                                           Length;
-       LARGE_INTEGER                                           EndingOffset;
-       ULONG                                                                   Key;
-       BOOLEAN                                                         ExclusiveLock;
-       PIRP                                                                    PendingIRP;
-       LIST_ENTRY                                                      NextFileLockEntry;
-} Ext2FileLockInfo, *PtrExt2FileLockInfo;
-
-#define                EXT2_BYTE_LOCK_NOT_FROM_ZONE                            (0x80000000)
-#define                EXT2_BYTE_LOCK_IS_PENDING                                       (0x00000001)
-
-/**************************************************************************
-       Every open on-disk object must have a name associated with it
-       This name has two components:
-       (a) the path-name (prefix) that leads to this on-disk object
-       (b) the name of the object itself
-       Note that with multiply linked objects, a single object might be
-       associated with more than one name structure.
-       This sample FSD does not correctly support multiply linked objects.
-
-       This structure must be quad-word aligned because it is zone allocated.
-**************************************************************************/
-typedef struct _Ext2ObjectName {
-       Ext2Identifier                                          NodeIdentifier;
-       uint32                                                          ObjectNameFlags;
-       // an absolute pathname of the object is stored below
-       UNICODE_STRING                                          ObjectName;
-} Ext2ObjectName, *PtrExt2ObjectName;
-
-#define                EXT2_OB_NAME_NOT_FROM_ZONE                              (0x80000000)
-
-/**************************************************************************
-       Each file open instance is represented by a context control block.
-       For each successful create/open request; a file object and a CCB will
-       be created.
-       For open operations performed internally by the FSD, there may not
-       exist file objects; but a CCB will definitely be created.
-
-       This structure must be quad-word aligned because it is zone allocated.
-**************************************************************************/
-typedef struct _Ext2ContextControlBlock {
-       Ext2Identifier                                          NodeIdentifier;
-       // ptr to the associated FCB
-       struct _Ext2FileControlBlock    *PtrFCB;
-       // all CCB structures for a FCB are linked together
-       LIST_ENTRY                                                      NextCCB;
-       // each CCB is associated with a file object
-       PFILE_OBJECT                                            PtrFileObject;
-       // flags (see below) associated with this CCB
-       uint32                                                          CCBFlags;
-       // current byte offset is required sometimes
-       LARGE_INTEGER                                           CurrentByteOffset;
-       // if this CCB represents a directory object open, we may
-       //      need to maintain a search pattern
-
-       //      PSTRING                                                         DirectorySearchPattern;
-       UNICODE_STRING                                          DirectorySearchPattern;
-
-       //      The full path name for the file...
-       UNICODE_STRING                  AbsolutePathName;
-
-       //      Rename/Link Target file name
-       //      Used only in a Rename/Link operation
-       UNICODE_STRING                  RenameLinkTargetFileName;
-
-       // we must maintain user specified file time values
-       uint32                                                          UserSpecifiedTime;
-
-
-} Ext2CCB, *PtrExt2CCB;
-
-
-/**************************************************************************
-       the following CCBFlags values are relevant. These flag
-       values are bit fields; therefore we can test whether
-       a bit position is set (1) or not set (0).
-**************************************************************************/
-
-// some on-disk file/directories are opened by EXT2 itself
-//     as opposed to being opened on behalf of a user process
-#define        EXT2_CCB_OPENED_BY_EXT2                                         (0x00000001)
-// the file object specified synchronous access at create/open time.
-//     this implies that EXT2 must maintain the current byte offset
-#define        EXT2_CCB_OPENED_FOR_SYNC_ACCESS                 (0x00000002)
-// file object specified sequential access for this file
-#define        EXT2_CCB_OPENED_FOR_SEQ_ACCESS                  (0x00000004)
-// the CCB has had an IRP_MJ_CLEANUP issued on it. we must
-//     no longer allow the file object / CCB to be used in I/O requests.
-#define        EXT2_CCB_CLEANED                                                                (0x00000008)
-// if we were invoked via the fast i/o path to perform file i/o;
-//     we should set the CCB access/modification time at cleanup
-#define        EXT2_CCB_ACCESSED                                                               (0x00000010)
-#define        EXT2_CCB_MODIFIED                                                               (0x00000020)
-// if an application process set the file date time, we must
-//     honor that request and *not* overwrite the values at cleanup
-#define        EXT2_CCB_ACCESS_TIME_SET                                        (0x00000040)
-#define        EXT2_CCB_MODIFY_TIME_SET                                        (0x00000080)
-#define        EXT2_CCB_CREATE_TIME_SET                                        (0x00000100)
-
-#define        EXT2_CCB_NOT_FROM_ZONE                                          (0x80000000)
-
-// this CCB was allocated for a "volume open" operation
-#define        EXT2_CCB_VOLUME_OPEN                                                    (0x00000100)
-
-/**************************************************************************
-       each open file/directory/volume is represented by a file control block.
-       NOTE: Currently, EXT2 does not handle multiply linked files correctly.
-                       In your FSD implementation, you must be careful about handling
-                       such on-disk files correctly i.e. a single (unique) FCB must
-                       represent an on-disk file/directory regardless of the path used
-                       to access the on-disk object.
-                       With the current EXT2 implementation, an on-disk file object
-                       with more than a single (hard) link will be treated incorrectly!
-
-       Each FCB can logically be divided into two:
-       (a) a structure that must have a field of type FSRTL_COMMON_FCB_HEADER
-                as the first field in the structure.
-                This portion should also contain other structures/resources required
-                by the NT Cache Manager
-                We will call this structure the "NT Required" FCB. Note that this
-                portion of the FCB must be allocated from non-paged pool.
-       (b) the remainder of the FCB is dependent upon the particular FSD
-                requirements.
-                This portion of the FCB could possibly be allocated from paged
-                memory, though in the sample FSD, it will always be allocated
-                from non-paged pool.
-
-       FCB structures are protected by the MainResource as well as the
-       PagingIoResource. Of course, if your FSD implementation requires
-       it, you can associate other syncronization structures with the
-       FCB.
-
-       This structure must be quad-word aligned because it is zone allocated.
-**************************************************************************/
-typedef struct _Ext2NTRequiredFCB 
-{
-    FSRTL_COMMON_FCB_HEADER                    CommonFCBHeader;
-       SECTION_OBJECT_POINTERS                 SectionObject;
-       ERESOURCE                                                       MainResource;
-       ERESOURCE                                                       PagingIoResource;
-} Ext2NTRequiredFCB, *PtrExt2NTRequiredFCB;
-
-typedef struct _Ext2DiskDependentFCB 
-{
-       // although the sample FSD does not maintain on-disk data structures,
-       //      this structure serves as a reminder of the logical separation that
-       //      your FSD can maintain between the disk dependent and the disk
-       //      independent portions of the FCB.
-       uint16                                                          DummyField;             // placeholder
-} Ext2DiskDependentFCB, *PtrExt2DiskDependentFCB;
-
-typedef struct _Ext2FileControlBlock 
-{
-       Ext2Identifier                                          NodeIdentifier;
-       // we will go ahead and embed the "NT Required FCB" right here.
-       //      Note though that it is just as acceptable to simply allocate
-       //      memory separately for the other half of the FCB and store a
-       //      pointer to the "NT Required" portion here instead of embedding
-       //      it ...
-       Ext2NTRequiredFCB                                       NTRequiredFCB;
-       // the disk dependent portion of the FCB is embedded right here
-       Ext2DiskDependentFCB                            DiskDependentFCB;
-       // this FCB belongs to some mounted logical volume
-       struct _Ext2VolumeControlBlock  *PtrVCB;
-       // to be able to access all open file(s) for a volume, we will
-       //      link all FCB structures for a logical volume together
-       LIST_ENTRY                                                      NextFCB;
-
-       //      to be used if this FCB is on the Closable FCB List...
-       struct _ClosableFCBs
-       {
-               LIST_ENTRY                                              ClosableFCBList;
-               BOOLEAN                                                 OnClosableFCBList;
-       }ClosableFCBs;
-
-       // some state information for the FCB is maintained using the
-       //      flags field
-       uint32                                                          FCBFlags;
-       // all CCB's for this particular FCB are linked off the following
-       //      list head.
-       LIST_ENTRY                                                      CCBListHead;
-       // NT requires that a file system maintain and honor the various
-       //      SHARE_ACCESS modes ...
-       SHARE_ACCESS                                            FCBShareAccess;
-       // to identify the lazy writer thread(s) we will grab and store
-       //      the thread id here when a request to acquire resource(s)
-       //      arrives ..
-       uint32                                                          LazyWriterThreadID;
-       // whenever a file stream has a create/open operation performed,
-       //      the Reference count below is incremented AND the OpenHandle count
-       //      below is also incremented.
-       //      When an IRP_MJ_CLEANUP is received, the OpenHandle count below
-       //      is decremented.
-       //      When an IRP_MJ_CLOSE is received, the Reference count below is
-       //      decremented.
-       //      When the Reference count goes down to zero, the FCB can be de-allocated.
-       //      Note that a zero Reference count implies a zero OpenHandle count.
-       //      This invariant must always hold true ... (if it is really an invariant,
-       // shoudn't the previous statement be redundant ... hmmm!!!)
-       LONG                                                            ReferenceCount;
-       LONG                                                            OpenHandleCount;
-       // for the sample fsd, there exists a 1-1 correspondence between an
-       //      object name structure and a FCB
-       PtrExt2ObjectName                                       FCBName;
-       // we will maintain some time information here to make our life easier
-       LARGE_INTEGER                                           CreationTime;
-       LARGE_INTEGER                                           LastAccessTime;
-       LARGE_INTEGER                                           LastWriteTime;
-       // Byte-range file lock support (we roll our own)
-       Ext2FileLockAnchor                              FCBByteRangeLock;
-       // The OPLOCK support package requires the following structure
-       OPLOCK                                                          FCBOplock;
-
-       //      The I-Node no of this file / folder
-       ULONG                   INodeNo;
-       ULONG                   ParentINodeNo;
-       //      Pointers to blocks 
-       uint32                  IBlock[EXT2_N_BLOCKS];
-       
-       USHORT                  LinkCount;
-       union   _DCBFCB
-       {
-               struct
-               {
-                       PFILE_OBJECT    PtrDirFileObject;
-               } Dcb;
-
-               struct _FCB
-               {
-                       PFILE_OBJECT    PtrDirFileObject;
-                       //      FCB specific stuff go here...
-               } Fcb;
-
-       }DcbFcb;
-
-} Ext2FCB, *PtrExt2FCB, Ext2DCB, *PtrExt2DCB;
-
-/**************************************************************************
-       the following FCBFlags values are relevant. These flag
-       values are bit fields; therefore we can test whether
-       a bit position is set (1) or not set (0).
-**************************************************************************/
-#define                EXT2_FCB_IN_INIT                                                        (0x00000001)
-#define                EXT2_FCB_IN_TEARDOWN                                            (0x00000002)
-#define                EXT2_FCB_PAGE_FILE                                                      (0x00000004)
-#define                EXT2_FCB_DIRECTORY                                                      (0x00000008)
-#define                EXT2_FCB_ROOT_DIRECTORY                                         (0x00000018)
-#define                EXT2_FCB_WRITE_THROUGH                                          (0x00000020)
-#define                EXT2_FCB_MAPPED                                                         (0x00000040)
-#define                EXT2_FCB_FAST_IO_READ_IN_PROGESS                        (0x00000080)
-#define                EXT2_FCB_FAST_IO_WRITE_IN_PROGESS                       (0x00000100)
-#define                EXT2_FCB_DELETE_ON_CLOSE                                        (0x00000200)
-#define                EXT2_FCB_MODIFIED                                                       (0x00000400)
-#define                EXT2_FCB_ACCESSED                                                       (0x00000800)
-#define                EXT2_FCB_READ_ONLY                                                      (0x00001000)
-
-#define                EXT2_INITIALIZED_MAIN_RESOURCE                          (0x00002000)
-#define                EXT2_INITIALIZED_PAGING_IO_RESOURCE                     (0x00004000)
-#define                EXT2_FCB_BLOCKS_INITIALIZED                                     (0x00008000)
-#define                EXT2_FCB_SPECIAL_FILE                                           (0x00010000)
-#define                EXT2_FCB_HIDDEN_FILE                                            (0x00020000)
-#define                EXT2_FCB_NOT_FROM_ZONE                                          (0x80000000)
-
-
-typedef struct _GroupDescriptors
-{
-       uint32  InodeTablesBlock;       /* Inodes table block   => bg_inode_table               */
-       uint32  InodeBitmapBlock;       /* Inodes bitmap block  => bg_inode_bitmap      */
-       uint32  BlockBitmapBlock;       /* Blocks bitmap block  => bg_block_bitmap      */
-       uint32  FreeBlocksCount;
-       uint32  FreeInodesCount;
-}Ext2GroupDescriptors, *PtrExt2GroupDescriptors;
-
-
-
-/**************************************************************************
-       A logical volume is represented using the following structure.
-       This structure is allocated as part of the device extension
-       for a device object that this sample FSD will create, to represent
-       the mounted logical volume.
-
-       NOTE: If you were to extend this sample FSD to be a "real" FSD,
-                       you would be worried about allocated clusters/sectiors,
-                       bitmaps providing such information for the mounted volume,
-                       dirty/modified clusters/sectiors etc.
-                       This sample FSD does not maintain such information in the
-                       in-memory VCB, though you may wish to consider it.
-**************************************************************************/
-typedef struct _Ext2VolumeControlBlock 
-{
-       Ext2Identifier                                          NodeIdentifier;
-
-    // Required to use the Cache Manager.
-       FSRTL_COMMON_FCB_HEADER                 CommonVCBHeader;
-       SECTION_OBJECT_POINTERS                 SectionObject;
-       // a resource to protect the fields contained within the VCB
-       ERESOURCE                                                       VCBResource;
-       
-       // a resource to synchronise paging io
-       ERESOURCE                                                       PagingIoResource;
-
-       // Pointer to a stream file object created for the volume information
-       // to be more easily read from secondary storage (with the support of
-       // the NT Cache Manager).
-       PFILE_OBJECT                                            PtrStreamFileObject;
-       
-       // each VCB is accessible off a global linked list
-       LIST_ENTRY                                                      NextVCB;
-       
-       // each VCB points to a VPB structure created by the NT I/O Manager
-       PVPB                                                                    PtrVPB;
-       
-       // a set of flags that might mean something useful
-       uint32                                                          VCBFlags;
-       
-       // A count of the number of open files/directories
-       //      As long as the count is != 0, the volume cannot
-       //      be dismounted or locked.
-       uint32                                                          VCBOpenCount;
-       
-       // a global list of all FCB structures associated with the VCB
-       LIST_ENTRY                                                      FCBListHead;
-
-       //
-       //      a list of FCBs created at the FSD's initiative...
-       //      These FCBs have a reference count of 0
-       //      This list should never be allowed to cross a limit...
-       //
-       struct Ext2ClosableFCB
-       {
-               LIST_ENTRY                                              ClosableFCBListHead;
-               ULONG                                                   Count;
-       }ClosableFCBs;
-       // we will maintain a global list of IRP's that are pending
-       //      because of a directory notify request.
-       LIST_ENTRY                                                      NextNotifyIRP;
-       // the above list is protected only by the mutex declared below
-       KMUTEX                                                          NotifyIRPMutex;
-       // for each mounted volume, we create a device object. Here then
-       //      is a back pointer to that device object
-       PDEVICE_OBJECT                                          VCBDeviceObject;
-       // We also retain a pointer to the physical device object on which we
-       // have mounted ourselves. The I/O Manager passes us a pointer to this
-       // device object when requesting a mount operation.
-       PDEVICE_OBJECT                                          TargetDeviceObject;
-       // the volume structure contains a pointer to the root directory FCB
-       PtrExt2FCB                                                      PtrRootDirectoryFCB;
-       // the complete name of the user visible drive letter we serve
-       uint8                                                                   *PtrVolumePath;
-       // For volume open operations, we do not create a FCB (we use the VCB
-       //      directly instead). Therefore, all CCB structures for the volume
-       //      open operation are linked directly off the VCB
-       LIST_ENTRY                                                      VolumeOpenListHead;
-
-
-       //      Volume information
-       ULONG   BlocksCount;
-       ULONG   InodesCount;
-       ULONG   ReservedBlocksCount;
-       ULONG   FreeBlocksCount;
-       ULONG   FreeInodesCount;
-       ULONG   LogBlockSize;                   // Block size = 1024 << LogBlockSize
-       ULONG   InodeSize;
-
-       //      Group Information Saved up in the VCB...
-       PtrExt2GroupDescriptors PtrGroupDescriptors;
-       ULONG   NoOfGroups;
-
-       uint32  InodesPerGroup;
-       uint32  BlocksPerGroup; 
-
-} Ext2VCB, *PtrExt2VCB;
-
-// some valid flags for the VCB
-#define                        EXT2_VCB_FLAGS_VOLUME_MOUNTED                   (0x00000001)
-#define                        EXT2_VCB_FLAGS_VOLUME_LOCKED                    (0x00000002)
-#define                        EXT2_VCB_FLAGS_BEING_DISMOUNTED         (0x00000004)
-#define                        EXT2_VCB_FLAGS_SHUTDOWN                                 (0x00000008)
-#define                        EXT2_VCB_FLAGS_VOLUME_READ_ONLY         (0x00000010)
-
-#define                        EXT2_VCB_FLAGS_VCB_INITIALIZED          (0x00000020)
-
-typedef struct _EXT2_IO_CONTEXT 
-{
-       Ext2Identifier                  NodeIdentifier;
-       ULONG                                   ReadWriteLength;
-       LONG                                    Count;
-       PIRP                                    PtrMasterIrp;
-       PKEVENT                                 PtrSyncEvent;
-
-} EXT2_IO_CONTEXT, *PEXT2_IO_CONTEXT;
-
-
-typedef struct _Ext2SavedBCBs
-{
-       Ext2Identifier                  NodeIdentifier;
-       PBCB                                    PtrBCB;
-       LIST_ENTRY                              SavedBCBsListEntry;
-
-} EXT2_SAVED_BCBS, *PEXT2_SAVED_BCBS;
-
-
-/**************************************************************************
-       The IRP context encapsulates the current request. This structure is
-       used in the "common" dispatch routines invoked either directly in
-       the context of the original requestor, or indirectly in the context
-       of a system worker thread.
-**************************************************************************/
-typedef struct _Ext2IrpContext
-{
-       Ext2Identifier                  NodeIdentifier;
-       uint32                                  IrpContextFlags;
-       // copied from the IRP
-       uint8                                   MajorFunction;
-       // copied from the IRP
-       uint8                                   MinorFunction;
-
-       // to queue this IRP for asynchronous processing
-       WORK_QUEUE_ITEM                 WorkQueueItem;
-       // the IRP for which this context structure was created
-       PIRP                                    Irp;
-       // the target of the request (obtained from the IRP)
-       PDEVICE_OBJECT                  TargetDeviceObject;
-       // if an exception occurs, we will store the code here
-       NTSTATUS                                SavedExceptionCode;
-       
-       //      This list entry is used if asnchronous processing is required...
-       LIST_ENTRY                              ThreadQueueListEntry;
-
-       //      This list entry is used if BCBs are to be saved and then flushed...
-       //      Could have been put somewhere else...
-       LIST_ENTRY                              SavedBCBsListHead;
-       ULONG                                   SavedCount;
-
-} Ext2IrpContext, *PtrExt2IrpContext;
-
-#define                        EXT2_IRP_CONTEXT_CAN_BLOCK                              (0x00000001)
-#define                        EXT2_IRP_CONTEXT_WRITE_THROUGH          (0x00000002)
-#define                        EXT2_IRP_CONTEXT_EXCEPTION                              (0x00000004)
-#define                        EXT2_IRP_CONTEXT_DEFERRED_WRITE         (0x00000008)
-#define                        EXT2_IRP_CONTEXT_ASYNC_PROCESSING       (0x00000010)
-#define                        EXT2_IRP_CONTEXT_NOT_TOP_LEVEL          (0x00000020)
-
-#define                        EXT2_IRP_CONTEXT_NOT_FROM_ZONE          (0x80000000)
-
-typedef struct _Ext2ThreadQueue
-{
-       HANDLE                          QueueHandlerThread;
-       
-       LIST_ENTRY                      ThreadQueueListHead;    //      This holds the Contexts 
-                                                                                               //      that are to be scheduled
-       KSPIN_LOCK                      SpinLock;                               //      To synchronize access to 
-                                                                                               //      the list
-       KEVENT                          QueueEvent;                             //      The Worker thread queue 
-                                                                                               //      package waits on this event
-}      Ext2ThreadQueue;
-
-/**************************************************************************
-       we will store all of our global variables in one structure.
-       Global variables are not specific to any mounted volume BUT
-       by definition are required for successful operation of the
-       FSD implementation.
-**************************************************************************/
-typedef struct _Ext2Data 
-{
-       Ext2Identifier                          NodeIdentifier;
-       // the fields in this list are protected by the following resource
-       ERESOURCE                                       GlobalDataResource;
-       // each driver has a driver object created for it by the NT I/O Mgr.
-       //      we are no exception to this rule.
-       PDRIVER_OBJECT                          Ext2DriverObject;
-       // we will create a device object for our FSD as well ...
-       //      Although not really required, it helps if a helper application
-       //      writen by us wishes to send us control information via
-       //      IOCTL requests ...
-       PDEVICE_OBJECT                          Ext2DeviceObject;
-       // we will keep a list of all logical volumes for our sample FSD
-       LIST_ENTRY                                      NextVCB;
-       // the NT Cache Manager, the I/O Manager and we will conspire
-       //      to bypass IRP usage using the function pointers contained
-       //      in the following structure
-       FAST_IO_DISPATCH                        Ext2FastIoDispatch;
-       // The NT Cache Manager uses the following call backs to ensure
-       //      correct locking hierarchy is maintained
-       CACHE_MANAGER_CALLBACKS CacheMgrCallBacks;
-       // structures allocated from a zone need some fields here. Note
-       //      that under version 4.0, it might be better to use lookaside
-       //      lists
-       KSPIN_LOCK                                      ZoneAllocationSpinLock;
-       ZONE_HEADER                                     ObjectNameZoneHeader;
-       ZONE_HEADER                                     CCBZoneHeader;
-       ZONE_HEADER                                     FCBZoneHeader;
-       ZONE_HEADER                                     ByteLockZoneHeader;
-       ZONE_HEADER                                     IrpContextZoneHeader;
-       void                                            *ObjectNameZone;
-       void                                            *CCBZone;
-       void                                            *FCBZone;
-       void                                            *ByteLockZone;
-       void                                            *IrpContextZone;
-       
-       //      currently, there is a single default zone size value used for
-       //      all zones. This should ideally be changed by you to be 1 per
-       //      type of zone (e.g. a default size for the FCB zone might be
-       //      different from the default size for the ByteLock zone).
-
-       //      Of course, you will need to use different values (min/max)
-       //      for lookaside lists (if you decide to use them instead)
-       uint32                                          DefaultZoneSizeInNumStructs;
-       
-       // some state information is maintained in the flags field
-       uint32                                          Ext2Flags;
-       
-       // Handle returned by the MUP is stored here.
-       HANDLE                                          MupHandle;
-       
-       //      Time difference 
-       LARGE_INTEGER                           TimeDiff;
-
-       //      The Worker Thread package uses this structure...
-       Ext2ThreadQueue                         ThreadQueue;
-
-}Ext2Data, *PtrExt2Data;
-
-// valid flag values for the global data structure
-#define                EXT2_DATA_FLAGS_RESOURCE_INITIALIZED            (0x00000001)
-#define                EXT2_DATA_FLAGS_ZONES_INITIALIZED                       (0x00000002)
-
-// a default size of the number of pages of non-paged pool allocated
-//     for each of the zones ...
-
-//     Note that the values are absolutely arbitrary, the only information
-//     worth using from the values themselves is that they increase for
-//     larger systems (i.e. systems with more memory)
-#define                EXT2_DEFAULT_ZONE_SIZE_SMALL_SYSTEM                     (0x4)
-#define                EXT2_DEFAULT_ZONE_SIZE_MEDIUM_SYSTEM            (0x8)
-#define                EXT2_DEFAULT_ZONE_SIZE_LARGE_SYSTEM                     (0xc)
-
-// another simplistic (brain dead ? :-) method used is to simply double
-//     the values for a "server" machine
-
-//     So, for all you guys who "modified" the registry ;-) to change the
-//     wkstation into a server, tough luck !
-#define                EXT2_NTAS_MULTIPLE                                                              (0x2)
-
-/***************************************************************************
-The following locking hierarchy is maintained in this sample filesystem
-driver:
-
-(a) the global structure resource can be acquired at any time. However,
-    it is an "end resource" i.e. once acquired, no other resource can
-        be obtained until the global structure resource is released.
-(b) the logical volume resource must be acquired (if required) before
-        any of the other resources are acquired.
-(c) a file control block can be acquired next (if required). If two
-    FCB structures need to be acquired, the FCB "higher" in the directory
-        tree must be acquired first.
-        For a FCB, the "main resource" must be acquired first before a
-        "paging i/o" resource is acquired.
-
-Whenever a file is opened, the logical volume structure is referenced.
-This ensures that the volume cannot be dismounted while any file is open.
-
-***************************************************************************/
-
-typedef struct _IO_RUN
-{
-       UINT LogicalBlock;
-       UINT StartOffset;
-       UINT EndOffset;
-       PIRP PtrAssociatedIrp;
-
-} EXT2_IO_RUN, *PEXT2_IO_RUN;
-
-typedef struct _SIBlocks
-{
-       PBCB    PtrBCB;
-       ULONG * PtrSIBlocks;
-} EXT2_SIBLOCKS, *PEXT2_SIBLOCKS;
-
-#endif // has this file been included?
-
diff --git a/drivers/filesystems/ext2/src/DiskIO.c b/drivers/filesystems/ext2/src/DiskIO.c
deleted file mode 100644 (file)
index 150db70..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-/*************************************************************************
-*
-* File: DiskIO.c
-*
-* Module: Ext2 File System Driver (Kernel mode execution only)
-*
-* Description:
-*      Should contain code to handle Disk IO.
-*
-*
-* Author: Manoj Paul Joseph
-*
-*
-*************************************************************************/
-
-#include                       "ext2fsd.h"
-
-#define                        EXT2_BUG_CHECK_ID                               EXT2_FILE_DISK_IO
-
-#define                        DEBUG_LEVEL                                             ( DEBUG_TRACE_DISKIO )
-
-
-/*************************************************************************
-*
-* Function: Ext2ReadLogicalBlocks()
-*
-* Description:
-*      The higherlevel functions will use this to read in logical blocks
-*      This function deals with the logical to physical block translation
-*
-*      LogicalBlock -  This is a 1 based index.
-*                                      That is, the first block is Block 1
-*
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL 
-*
-* Return Value: The Status of the Read IO
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2ReadLogicalBlocks (
-       PDEVICE_OBJECT          PtrTargetDeviceObject,  //      the Target Device Object
-       VOID                            *Buffer,                                //      The Buffer that takes the data read in
-       LARGE_INTEGER           StartLogicalBlock,              //      The logical block from which reading is to start
-       unsigned int            NoOfLogicalBlocks               //      The no. of logical blocks to be read
-       )                                       
-{
-       //      The Status to be returned...
-       NTSTATUS Status = STATUS_SUCCESS;
-
-       //      The Device Object representing the mounted volume
-       PDEVICE_OBJECT PtrVolumeDeviceObject = NULL;
-       
-       //      Volume Control Block
-       PtrExt2VCB PtrVCB = NULL;
-
-       //      Logical Block Size
-       ULONG LogicalBlockSize;
-
-       // Physical Block Size
-       ULONG PhysicalBlockSize;
-
-       //      The starting Physical Block No...
-       LARGE_INTEGER StartPhysicalBlock;
-
-       unsigned int            NoOfPhysicalBlocks;
-
-
-
-       //      Done with declerations...
-       //      Now for some code ;)
-
-       //      Getting the Logical and Physical Sector sizes
-       PtrVolumeDeviceObject = PtrTargetDeviceObject->Vpb->DeviceObject;
-       ASSERT( PtrVolumeDeviceObject );
-       PtrVCB = (PtrExt2VCB)(PtrVolumeDeviceObject->DeviceExtension);
-       ASSERT(PtrVCB);
-       ASSERT(PtrVCB->NodeIdentifier.NodeType == EXT2_NODE_TYPE_VCB);
-
-       LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-       PhysicalBlockSize = PtrTargetDeviceObject->SectorSize;
-       
-       NoOfPhysicalBlocks = NoOfLogicalBlocks * LogicalBlockSize / PhysicalBlockSize;
-
-       StartPhysicalBlock.QuadPart = ( StartLogicalBlock.QuadPart ) * 
-                                                                       ( LogicalBlockSize / PhysicalBlockSize );
-
-       Status = Ext2ReadPhysicalBlocks( PtrTargetDeviceObject,
-                                       Buffer, StartPhysicalBlock,     NoOfPhysicalBlocks );
-               
-       return Status;
-}
-
-/*************************************************************************
-*
-* Function: Ext2ReadPhysicalBlocks()
-*
-* Description:
-*      The higherlevel functions will use this to read in physical blocks
-*
-*      PhysicalBlock - This is a 0 based number.
-*                                      That is, the first block is Block 0
-*
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL 
-*
-* Return Value: The Status of the Read IO
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2ReadPhysicalBlocks (
-       PDEVICE_OBJECT          PtrTargetDeviceObject,  //      the Target Device Object
-       VOID                            *Buffer,                                //      The Buffer that takes the data read in
-       LARGE_INTEGER           StartPhysicalBlock,             //      The block from which reading is to start
-       unsigned int            NoOfBlocks              //      The no. of blocks to be read
-       )                                       
-{
-       //      The Status to be returned...
-       NTSTATUS Status = STATUS_SUCCESS;
-
-       // Physical Block Size
-       ULONG PhysicalBlockSize;
-
-       // No of bytes to read
-       ULONG NumberOfBytesToRead;
-
-       //      Synchronisation Event
-       KEVENT Event;
-
-       //      IRP
-    PIRP Irp;
-
-       //      Status Block
-    IO_STATUS_BLOCK Iosb;
-
-       //      Byte Offset
-       LARGE_INTEGER ByteOffset;
-
-       //      Done with declerations...
-       //      Now for some code ;)
-
-       //      Getting the Physical Sector size
-       PhysicalBlockSize = PtrTargetDeviceObject->SectorSize;
-       
-       NumberOfBytesToRead = PhysicalBlockSize * NoOfBlocks;
-
-       ByteOffset.QuadPart = StartPhysicalBlock.QuadPart * PhysicalBlockSize;
-
-       try
-       {
-               //
-               //  Initialize the event we're going to use
-               //
-               KeInitializeEvent( &Event, NotificationEvent, FALSE );
-
-               //
-               //  Build the irp for the operation and also set the overrride flag
-               //
-               Irp = IoBuildSynchronousFsdRequest( IRP_MJ_READ,
-                                                                                       PtrTargetDeviceObject,
-                                                                                       Buffer,
-                                                                                       NumberOfBytesToRead,
-                                                                                       &ByteOffset ,
-                                                                                       &Event,
-                                                                                       &Iosb );
-
-               if ( Irp == NULL ) 
-               {
-                       DebugTrace(DEBUG_TRACE_MISC,   " !!!! Unable to create an IRP", 0 );
-                       Status = STATUS_INSUFFICIENT_RESOURCES;
-                       try_return();
-               }
-
-               //
-               //  Call the device to do the read and wait for it to finish.
-               //
-               Status = IoCallDriver( PtrTargetDeviceObject, Irp );
-
-               //
-               //      Check if it is done already!!!!
-               //
-               if (Status == STATUS_PENDING) 
-               {
-                       //
-                       //      Read not done yet...
-                       //      Wait till it is...
-                       //
-                       (VOID)KeWaitForSingleObject( &Event, Executive, KernelMode, FALSE, (PLARGE_INTEGER)NULL );
-                       Status = Iosb.Status;
-               }
-
-               try_exit:       NOTHING;
-       }
-       finally
-       {
-               if (!NT_SUCCESS(Status)) 
-               {
-                       if( Status == STATUS_VERIFY_REQUIRED )
-                       {
-                               DebugTrace(DEBUG_TRACE_MISC,   " !!!! Verify Required! Failed to read disk",0 );
-                       }
-                       else if (Status == STATUS_INVALID_PARAMETER) 
-                       {
-                               DebugTrace(DEBUG_TRACE_MISC,   " !!!! Invalid Parameter! Failed to read disk",0 );
-                       }
-                       else 
-                       {
-                               DebugTrace(DEBUG_TRACE_MISC,   " !!!! Failed to read disk! Status returned = %d", Status );
-                       }
-               }
-       }
-       return Status;
-}
-
-
diff --git a/drivers/filesystems/ext2/src/devcntrl.c b/drivers/filesystems/ext2/src/devcntrl.c
deleted file mode 100644 (file)
index 74942d6..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*************************************************************************
-*
-* File: devcntrl.c
-*
-* Module: Ext2 File System Driver (Kernel mode execution only)
-*
-* Description:
-*      Contains code to handle the "Device IOCTL" dispatch entry point.
-*
-* Author: Manoj Paul Joseph
-*
-*
-*************************************************************************/
-
-#include                       "ext2fsd.h"
-
-// define the file specific bug-check id
-#define                        EXT2_BUG_CHECK_ID                               EXT2_FILE_DEVICE_CONTROL
-#define                        DEBUG_LEVEL                                             DEBUG_TRACE_DEVCTRL
-
-
-#if(_WIN32_WINNT < 0x0400)
-#define IOCTL_REDIR_QUERY_PATH   CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 99, METHOD_NEITHER, FILE_ANY_ACCESS)
-
-typedef struct _QUERY_PATH_REQUEST 
-{
-    ULONG PathNameLength;
-    PIO_SECURITY_CONTEXT SecurityContext;
-    WCHAR FilePathName[1];
-} QUERY_PATH_REQUEST, *PQUERY_PATH_REQUEST;
-
-typedef struct _QUERY_PATH_RESPONSE 
-{
-    ULONG LengthAccepted;
-} QUERY_PATH_RESPONSE, *PQUERY_PATH_RESPONSE;
-#endif
-
-
-/*************************************************************************
-*
-* Function: Ext2DeviceControl()
-*
-* Description:
-*      The I/O Manager will invoke this routine to handle a Device IOCTL
-*      request
-*
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL (invocation at higher IRQL will cause execution
-*      to be deferred to a worker thread context)
-*
-* Return Value: STATUS_SUCCESS/Error
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2DeviceControl(
-PDEVICE_OBJECT         DeviceObject,           // the logical volume device object
-PIRP                                   Irp)                                    // I/O Request Packet
-{
-       NTSTATUS                                RC = STATUS_SUCCESS;
-   PtrExt2IrpContext   PtrIrpContext = NULL;
-       BOOLEAN                         AreWeTopLevel = FALSE;
-
-       //      Ext2BreakPoint();
-       
-       DebugTrace(DEBUG_TRACE_IRP_ENTRY,   "Device Control IRP Received...", 0);
-
-       FsRtlEnterFileSystem();
-       ASSERT(DeviceObject);
-       ASSERT(Irp);
-
-       // set the top level context
-       AreWeTopLevel = Ext2IsIrpTopLevel(Irp);
-
-       try {
-
-               // get an IRP context structure and issue the request
-               PtrIrpContext = Ext2AllocateIrpContext(Irp, DeviceObject);
-               ASSERT(PtrIrpContext);
-
-               RC = Ext2CommonDeviceControl(PtrIrpContext, Irp);
-
-       } except (Ext2ExceptionFilter(PtrIrpContext, GetExceptionInformation())) {
-
-               RC = Ext2ExceptionHandler(PtrIrpContext, Irp);
-
-               Ext2LogEvent(EXT2_ERROR_INTERNAL_ERROR, RC);
-       }
-
-       if (AreWeTopLevel) {
-               IoSetTopLevelIrp(NULL);
-       }
-
-       FsRtlExitFileSystem();
-
-       return(RC);
-}
-
-
-/*************************************************************************
-*
-* Function: Ext2CommonDeviceControl()
-*
-* Description:
-*      The actual work is performed here. This routine may be invoked in one'
-*      of the two possible contexts:
-*      (a) in the context of a system worker thread
-*      (b) in the context of the original caller
-*
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL
-*
-* Return Value: STATUS_SUCCESS/Error
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2CommonDeviceControl(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                                   PtrIrp)
-{
-       NTSTATUS                                        RC = STATUS_SUCCESS;
-       PIO_STACK_LOCATION      PtrIoStackLocation = NULL;
-       PIO_STACK_LOCATION      PtrNextIoStackLocation = NULL;
-       PFILE_OBJECT                    PtrFileObject = NULL;
-       PtrExt2FCB                              PtrFCB = NULL;
-       PtrExt2CCB                              PtrCCB = NULL;
-       PtrExt2VCB                              PtrVCB = NULL;
-       ULONG                                           IoControlCode = 0;
-
-       try 
-       {
-               // First, get a pointer to the current I/O stack location
-               PtrIoStackLocation = IoGetCurrentIrpStackLocation(PtrIrp);
-               ASSERT(PtrIoStackLocation);
-
-               PtrFileObject = PtrIoStackLocation->FileObject;
-               ASSERT(PtrFileObject);
-
-               PtrCCB = (PtrExt2CCB)(PtrFileObject->FsContext2);
-               ASSERT(PtrCCB);
-               PtrFCB = PtrCCB->PtrFCB;
-               ASSERT(PtrFCB);
-               
-
-               if( PtrFCB->NodeIdentifier.NodeType == EXT2_NODE_TYPE_VCB )
-               {
-                       PtrVCB = (PtrExt2VCB)(PtrFCB);
-               }
-               else
-               {
-                       AssertFCB( PtrFCB );
-                       ASSERT(PtrFCB->NodeIdentifier.NodeType == EXT2_NODE_TYPE_FCB);
-                       PtrVCB = PtrFCB->PtrVCB;
-               }
-
-               // Get the IoControlCode value
-               IoControlCode = PtrIoStackLocation->Parameters.DeviceIoControl.IoControlCode;
-
-               // You may wish to allow only   volume open operations.
-
-               // Invoke the lower level driver in the chain.
-               PtrNextIoStackLocation = IoGetNextIrpStackLocation(PtrIrp);
-               *PtrNextIoStackLocation = *PtrIoStackLocation;
-               // Set a completion routine.
-               IoSetCompletionRoutine(PtrIrp, Ext2DevIoctlCompletion, NULL, TRUE, TRUE, TRUE);
-               // Send the request.
-               RC = IoCallDriver(PtrVCB->TargetDeviceObject, PtrIrp);
-       } 
-       finally 
-       {
-               // Release the IRP context
-               if (!(PtrIrpContext->IrpContextFlags & EXT2_IRP_CONTEXT_EXCEPTION)) 
-               {
-                       // Free up the Irp Context
-                       Ext2ReleaseIrpContext(PtrIrpContext);
-               }
-       }
-
-       return(RC);
-}
-
-
-/*************************************************************************
-*
-* Function: Ext2DevIoctlCompletion()
-*
-* Description:
-*      Completion routine.
-*      
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL
-*
-* Return Value: STATUS_SUCCESS
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2DevIoctlCompletion(
-PDEVICE_OBJECT                 PtrDeviceObject,
-PIRP                                           PtrIrp,
-void                                           *Context)
-{
-       if (PtrIrp->PendingReturned) {
-               IoMarkIrpPending(PtrIrp);
-       }
-
-       return(STATUS_SUCCESS);
-}
diff --git a/drivers/filesystems/ext2/src/dircntrl.c b/drivers/filesystems/ext2/src/dircntrl.c
deleted file mode 100644 (file)
index a3e3e16..0000000
+++ /dev/null
@@ -1,933 +0,0 @@
-/*************************************************************************
-*
-* File: dircntrl.c
-*
-* Module: Ext2 File System Driver (Kernel mode execution only)
-*
-* Description:
-*      Contains code to handle the "directory control" dispatch entry point.
-*
-* Author: Manoj Paul Joseph
-*
-*
-*************************************************************************/
-
-#include                       "ext2fsd.h"
-
-// define the file specific bug-check id
-#define                        EXT2_BUG_CHECK_ID                               EXT2_FILE_DIR_CONTROL
-
-#define                        DEBUG_LEVEL                                             (DEBUG_TRACE_DIRCTRL)
-
-
-/*************************************************************************
-*
-* Function: Ext2DirControl()
-*
-* Description:
-*      The I/O Manager will invoke this routine to handle a directory control
-*      request
-*
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL (invocation at higher IRQL will cause execution
-*      to be deferred to a worker thread context)
-*
-* Return Value: STATUS_SUCCESS/Error
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2DirControl(
-PDEVICE_OBJECT         DeviceObject,           // the logical volume device object
-PIRP                                   Irp)                                    // I/O Request Packet
-{
-       NTSTATUS                        RC = STATUS_SUCCESS;
-    PtrExt2IrpContext  PtrIrpContext = NULL;
-       BOOLEAN                         AreWeTopLevel = FALSE;
-
-       DebugTrace(DEBUG_TRACE_IRP_ENTRY,   "DIR Control IRP received...", 0);
-
-       
-       FsRtlEnterFileSystem();
-
-       ASSERT(DeviceObject);
-       ASSERT(Irp);
-
-       // set the top level context
-       AreWeTopLevel = Ext2IsIrpTopLevel(Irp);
-
-       try 
-       {
-               // get an IRP context structure and issue the request
-               PtrIrpContext = Ext2AllocateIrpContext(Irp, DeviceObject);
-               ASSERT(PtrIrpContext);
-
-               RC = Ext2CommonDirControl(PtrIrpContext, Irp);
-
-       }
-       except (Ext2ExceptionFilter(PtrIrpContext, GetExceptionInformation())) 
-       {
-
-               RC = Ext2ExceptionHandler(PtrIrpContext, Irp);
-
-               Ext2LogEvent(EXT2_ERROR_INTERNAL_ERROR, RC);
-       }
-
-       if (AreWeTopLevel) {
-               IoSetTopLevelIrp(NULL);
-       }
-
-       FsRtlExitFileSystem();
-
-       return(RC);
-}
-
-
-
-/*************************************************************************
-*
-* Function: Ext2CommonDirControl()
-*
-* Description:
-*      The actual work is performed here. This routine may be invoked in one'
-*      of the two possible contexts:
-*      (a) in the context of a system worker thread
-*      (b) in the context of the original caller
-*
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL
-*
-* Return Value: STATUS_SUCCESS/Error
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2CommonDirControl(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                                   PtrIrp)
-{
-       NTSTATUS                                        RC = STATUS_SUCCESS;
-       PIO_STACK_LOCATION      PtrIoStackLocation = NULL;
-       PFILE_OBJECT                    PtrFileObject = NULL;
-       PtrExt2FCB                              PtrFCB = NULL;
-       PtrExt2CCB                              PtrCCB = NULL;
-
-       // First, get a pointer to the current I/O stack location
-       PtrIoStackLocation = IoGetCurrentIrpStackLocation(PtrIrp);
-       ASSERT(PtrIoStackLocation);
-
-       PtrFileObject = PtrIoStackLocation->FileObject;
-       ASSERT(PtrFileObject);
-
-       // Get the FCB and CCB pointers
-       PtrCCB = (PtrExt2CCB)(PtrFileObject->FsContext2);
-       ASSERT(PtrCCB);
-       PtrFCB = PtrCCB->PtrFCB;
-
-       AssertFCB( PtrFCB );
-       
-
-       // Get some of the parameters supplied to us
-       switch (PtrIoStackLocation->MinorFunction) {
-       case IRP_MN_QUERY_DIRECTORY:
-#ifdef _GNU_NTIFS_
-               RC = Ext2QueryDirectory(PtrIrpContext, PtrIrp, (PEXTENDED_IO_STACK_LOCATION)PtrIoStackLocation, PtrFileObject, PtrFCB, PtrCCB);
-#else
-               RC = Ext2QueryDirectory(PtrIrpContext, PtrIrp, PtrIoStackLocation, PtrFileObject, PtrFCB, PtrCCB);
-#endif
-               break;
-       case IRP_MN_NOTIFY_CHANGE_DIRECTORY:
-               {
-                       RC = STATUS_NOT_IMPLEMENTED;
-                       PtrIrp->IoStatus.Status = RC;
-                       PtrIrp->IoStatus.Information = 0;
-                       IoCompleteRequest(PtrIrp, IO_DISK_INCREMENT);
-               }
-               //      RC = Ext2NotifyChangeDirectory(PtrIrpContext, PtrIrp, PtrIoStackLocation, PtrFileObject, PtrFCB, PtrCCB);
-               break;
-       default:
-               // This should not happen.
-               RC = STATUS_INVALID_DEVICE_REQUEST;
-               PtrIrp->IoStatus.Status = RC;
-               PtrIrp->IoStatus.Information = 0;
-
-               // Free up the Irp Context
-               Ext2ReleaseIrpContext(PtrIrpContext);
-
-               // complete the IRP
-               IoCompleteRequest(PtrIrp, IO_NO_INCREMENT);
-               break;
-       }
-
-       return(RC);
-}
-
-
-/*************************************************************************
-*
-* Function: Ext2QueryDirectory()
-*
-* Description:
-*      Query directory request.
-*
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL
-*
-* Return Value: STATUS_SUCCESS/Error
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2QueryDirectory(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                           PtrIrp,
-#ifdef _GNU_NTIFS_
-PEXTENDED_IO_STACK_LOCATION                    PtrIoStackLocation,
-#else
-PIO_STACK_LOCATION                     PtrIoStackLocation,
-#endif
-PFILE_OBJECT                           PtrFileObject,
-PtrExt2FCB                                     PtrFCB,
-PtrExt2CCB                                     PtrCCB)
-{
-       NTSTATUS                                RC = STATUS_SUCCESS;
-       BOOLEAN                                 PostRequest = FALSE;
-       PtrExt2NTRequiredFCB    PtrReqdFCB = NULL;
-       BOOLEAN                                 CanWait = FALSE;
-       PtrExt2VCB                              PtrVCB = NULL;
-       BOOLEAN                                 AcquiredFCB = FALSE;
-       unsigned long                   BufferLength = 0;
-       unsigned long                   BufferIndex     = 0;
-       unsigned long                   FileIndex = 0;
-       PUNICODE_STRING                 PtrSearchPattern = NULL;
-       FILE_INFORMATION_CLASS  FileInformationClass;
-       BOOLEAN                                 RestartScan = FALSE;
-       BOOLEAN                                 ReturnSingleEntry = FALSE;
-       BOOLEAN                                 IndexSpecified = FALSE;
-       unsigned char                   *Buffer = NULL;
-       BOOLEAN                                 FirstTimeQuery = FALSE;
-       unsigned long                   StartingIndexForSearch = 0;
-       unsigned long                   BytesReturned = 0;
-       BOOLEAN                                 BufferUsedup = FALSE;
-
-       BOOLEAN                                 SearchWithWildCards = FALSE;
-       
-       PFILE_BOTH_DIR_INFORMATION              BothDirInformation = NULL;
-       PFILE_DIRECTORY_INFORMATION             DirectoryInformation = NULL;
-
-       
-       PEXT2_DIR_ENTRY         PtrDirEntry = NULL;
-       PEXT2_INODE                     PtrInode        = NULL;
-       
-       unsigned long           LogicalBlockSize;
-       
-       unsigned long           ThisBlock;
-       
-       //      The starting Physical Block No...
-       //LARGE_INTEGER StartPhysicalBlock;
-       LARGE_INTEGER StartBufferOffset ;
-       ULONG PinBufferLength;
-               
-       //      Buffer Control Block
-       PBCB                            PtrBCB = NULL;
-       BYTE *                          PtrPinnedBlockBuffer = NULL;
-
-       unsigned int j;
-       
-       DebugTrace(DEBUG_TRACE_MISC,   " === Querying Directory %S", PtrFCB->FCBName->ObjectName.Buffer );
-
-       try 
-       {
-               // Validate the sent-in FCB
-               if ((PtrFCB->NodeIdentifier.NodeType == EXT2_NODE_TYPE_VCB) || !(PtrFCB->FCBFlags & EXT2_FCB_DIRECTORY)) 
-               {
-                       // We will only allow notify requests on directories.
-                       RC = STATUS_INVALID_PARAMETER;
-               }
-
-               PtrReqdFCB = &(PtrFCB->NTRequiredFCB);
-               CanWait = ((PtrIrpContext->IrpContextFlags & EXT2_IRP_CONTEXT_CAN_BLOCK) ? TRUE : FALSE);
-               PtrVCB = PtrFCB->PtrVCB;
-
-               //
-               //      Asynchronous IO requested
-               //      Posting request...
-               //
-               /*
-                * This is incorrect because posted IRP_MJ_DIRECTORY_CONTROL
-                * requests aren't handled in the worker thread yet. I tried
-                * adding handling of them to the worked routine, but there
-                * were problems with accessing the PtrIoStackLocation->
-                * Parameters.QueryDirectory.FileName variable.
-                * -- Filip Navara, 18/08/2004
-                */
-#if 0
-               if (!CanWait) 
-               {
-                       PostRequest = TRUE;
-                       try_return(RC = STATUS_PENDING);
-               }
-#endif
-
-               // Obtain the callers parameters
-               BufferLength = PtrIoStackLocation->Parameters.QueryDirectory.Length;
-               PtrSearchPattern = ( PUNICODE_STRING    ) PtrIoStackLocation->Parameters.QueryDirectory.FileName;
-               FileInformationClass = PtrIoStackLocation->Parameters.QueryDirectory.FileInformationClass;
-               FileIndex = PtrIoStackLocation->Parameters.QueryDirectory.FileIndex;
-
-               // Some additional arguments that affect the FSD behavior
-               RestartScan       = (PtrIoStackLocation->Flags & SL_RESTART_SCAN);
-               ReturnSingleEntry = (PtrIoStackLocation->Flags & SL_RETURN_SINGLE_ENTRY);
-               IndexSpecified    = (PtrIoStackLocation->Flags & SL_INDEX_SPECIFIED);
-
-               //
-               // Acquiring exclusive access to the FCB.
-               // This is not mandatory
-               //
-               DebugTrace(DEBUG_TRACE_MISC,   "*** Going into a block to acquire FCB Exclusively[DirCtrl]", 0);
-
-               DebugTraceState( "FCBMain   AC:0x%LX   SW:0x%LX   EX:0x%LX   [DirCtrl]", PtrReqdFCB->MainResource.ActiveCount, PtrReqdFCB->MainResource.NumberOfExclusiveWaiters, PtrReqdFCB->MainResource.NumberOfSharedWaiters );
-               ExAcquireResourceExclusiveLite(&(PtrReqdFCB->MainResource), TRUE);
-               
-               DebugTrace(DEBUG_TRACE_MISC,   "*** FCB acquired [DirCtrl]", 0);
-               AcquiredFCB = TRUE;
-
-               // We must determine the buffer pointer to be used. Since this
-               // routine could either be invoked directly in the context of the
-               // calling thread, or in the context of a worker thread, here is
-               // a general way of determining what we should use.
-               Buffer = Ext2GetCallersBuffer ( PtrIrp );
-
-               // The method of determining where to look from and what to look for is
-               // unfortunately extremely confusing. However, here is a methodology you
-               // you can broadly adopt:
-               // (a) You have to maintain a search buffer per CCB structure.
-               // (b) This search buffer is initialized the very first time
-               //               a query directory operation is performed using the file object.
-               // (For the sample FSD, the search buffer is stored in the
-               //       DirectorySearchPattern field)
-               // However, the caller still has the option of "overriding" this stored
-               // search pattern by supplying a new one in a query directory operation.
-               //
-
-               if( PtrCCB->DirectorySearchPattern.Length )
-               {
-                       if( PtrCCB->DirectorySearchPattern.Buffer[PtrCCB->DirectorySearchPattern.Length/2] != 0 )
-                       {
-                               DebugTrace(DEBUG_TRACE_MISC,  "&&&&&&&&&  PtrCCB->DirectorySearchPattern not NULL terminated!", 0);
-                       }
-                       DebugTrace(DEBUG_TRACE_MISC,   " === Old Search pattern %S", PtrCCB->DirectorySearchPattern.Buffer );
-               }
-
-               if (PtrSearchPattern != NULL) 
-               {
-                       // User has supplied a search pattern
-                       // Now validate that the search pattern is legitimate
-
-                       if ( PtrCCB->DirectorySearchPattern.Length == 0 ) 
-                       {
-                               // This must be the very first query request.
-                               FirstTimeQuery = TRUE;
-                       }
-                       else
-                       {
-                               // We should ignore the search pattern in the CCB and instead,
-                               // use the user-supplied pattern for this particular query
-                               // directory request.
-                               Ext2DeallocateUnicodeString( &PtrCCB->DirectorySearchPattern );
-                       }
-
-                       // Now, allocate enough memory to contain the caller
-                       // supplied search pattern and fill in the DirectorySearchPattern
-                       // field in the CCB
-                       Ext2CopyUnicodeString( &PtrCCB->DirectorySearchPattern, PtrSearchPattern );
-                       /*
-                       PtrCCB->DirectorySearchPattern = Ext2AllocatePool(PagedPool, sizeof( PtrSearchPattern ) );
-                       ASSERT(PtrCCB->DirectorySearchPattern);
-                       RtlCopyMemory( PtrCCB->DirectorySearchPattern, PtrSearchPattern, sizeof( PtrSearchPattern ) );
-                       */
-               }
-               else if ( PtrCCB->DirectorySearchPattern.Length == 0 ) 
-               {
-                       // This MUST be the first directory query operation (else the
-                       // DirectorySearchPattern field would never be empty. Also, the caller
-                       // has neglected to provide a pattern so we MUST invent one.
-                       // Use "*" (following NT conventions) as your search pattern
-                       // and store it in the PtrCCB->DirectorySearchPattern field.
-                       
-                       /*
-                       PtrCCB->DirectorySearchPattern = Ext2AllocatePool(PagedPool, sizeof(L"*") );
-                       ASSERT(PtrCCB->DirectorySearchPattern);
-                       RtlCopyMemory( PtrCCB->DirectorySearchPattern, L"*", 4 );*/
-
-                       Ext2CopyWideCharToUnicodeString( &PtrCCB->DirectorySearchPattern, L"*" );
-                       
-                       FirstTimeQuery = TRUE;
-               } 
-               else 
-               {
-                       // The caller has not supplied any search pattern...
-                       // Using previously supplied pattern
-                       PtrSearchPattern = &PtrCCB->DirectorySearchPattern;
-               }
-
-               if( PtrCCB->DirectorySearchPattern.Buffer[PtrCCB->DirectorySearchPattern.Length/2] != 0 )
-               {
-                       DebugTrace(DEBUG_TRACE_MISC,  "&&&&&&&&&  PtrCCB->DirectorySearchPattern not NULL terminated!", 0 );
-               }
-               DebugTrace(DEBUG_TRACE_MISC,   " === Search pattern %S", PtrCCB->DirectorySearchPattern.Buffer );
-               SearchWithWildCards = FsRtlDoesNameContainWildCards( PtrSearchPattern );
-
-               // There is one other piece of information that your FSD must store
-               // in the CCB structure for query directory support. This is the index
-               // value (i.e. the offset in your on-disk directory structure) from
-               // which you should start searching.
-               // However, the flags supplied with the IRP can make us override this
-               // as well.
-
-               if (FileIndex) 
-               {
-                       // Caller has told us wherefrom to begin.
-                       // You may need to round this to an appropriate directory entry
-                       // entry alignment value.
-                       StartingIndexForSearch = FileIndex;
-               } 
-               else if (RestartScan) 
-               {
-                       StartingIndexForSearch = 0;
-               } 
-               else 
-               {
-                       // Get the starting offset from the CCB.
-                       StartingIndexForSearch = PtrCCB->CurrentByteOffset.LowPart;
-               }
-
-               //      Read in the file inode if it hasn't already been read...
-               Ext2InitializeFCBInodeInfo( PtrFCB );
-               
-               if (PtrFileObject->PrivateCacheMap == NULL) 
-               {
-                       CcInitializeCacheMap(PtrFileObject, (PCC_FILE_SIZES)(&(PtrReqdFCB->CommonFCBHeader.AllocationSize)),
-                               TRUE,           // We will utilize pin access for directories
-                               &(Ext2GlobalData.CacheMgrCallBacks), // callbacks
-                               PtrCCB);                // The context used in callbacks
-               }
-
-
-               //
-               //      Read in the next Data Block of this directory
-               //
-               LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-               StartBufferOffset.QuadPart = ( StartingIndexForSearch / LogicalBlockSize );
-               StartBufferOffset.QuadPart *= LogicalBlockSize; //      This should be the StartBufferOffset alaigned to LBlock boundary...
-               
-               PinBufferLength = PtrReqdFCB->CommonFCBHeader.FileSize.LowPart - StartBufferOffset.LowPart;
-
-               if ( !CcMapData( PtrFileObject,
-                  &StartBufferOffset,
-                  PinBufferLength,
-                  TRUE,
-                  &PtrBCB,
-                  (PVOID*)&PtrPinnedBlockBuffer ) )
-               {
-                       //      Read Failure
-                       DebugTrace(DEBUG_TRACE_MISC,   "Cache read failiure while reading in volume meta data", 0);
-                       try_return();
-               }
-               else
-               {
-                       DebugTrace(DEBUG_TRACE_MISC,   "Cache hit while reading in volume meta data", 0);
-               }
-               
-               PtrInode = Ext2AllocatePool( PagedPool, sizeof( EXT2_INODE )  );
-
-               //
-               //      Walking through the directory entries...
-               for( BufferUsedup = FALSE, BufferIndex = 0; !BufferUsedup && StartingIndexForSearch < ( PtrFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart - 1) ; )
-               {
-                       PtrDirEntry = (PEXT2_DIR_ENTRY) &PtrPinnedBlockBuffer[ StartingIndexForSearch - StartBufferOffset.LowPart ];
-                       
-                       StartingIndexForSearch += PtrDirEntry->rec_len;
-                       PtrCCB->CurrentByteOffset.LowPart = StartingIndexForSearch;
-
-                       if( PtrDirEntry->inode == 0 )
-                       {
-                               continue;
-                       }
-                       if( PtrDirEntry->name_len == 0 || PtrDirEntry->rec_len == 0 )
-                       {
-                               //
-                               //      This should not happen
-                               //      Hqw can this be so!!!
-                               //
-                               Ext2BreakPoint();
-                               if( BothDirInformation )
-                               {
-                                       BothDirInformation->NextEntryOffset = 0;
-                               }
-                               if( !BytesReturned )
-                               {
-                                       if( FirstTimeQuery )
-                                               RC = STATUS_NO_SUCH_FILE;
-                                       else
-                                               RC = STATUS_NO_MORE_FILES;
-                               }
-                               break;
-                       }
-
-                       //      Does this entry match the search criterian?
-                       //      Checking
-                       //
-                       {
-                               UNICODE_STRING  FileName;
-                               LONG    Matched = 0;
-                               // Constructing a counted Unicode string out of PtrDirEntry
-                               Ext2CopyCharToUnicodeString( &FileName, PtrDirEntry->name, PtrDirEntry->name_len );
-
-                               if ( SearchWithWildCards )
-                               {
-                                       Matched = FsRtlIsNameInExpression ( PtrSearchPattern, &FileName, FALSE, NULL );
-                               }
-                               else
-                               {
-                                       Matched = ! RtlCompareUnicodeString( PtrSearchPattern, &FileName, FALSE );
-                               }
-                       
-                               Ext2DeallocateUnicodeString( &FileName );
-                               if( !Matched )
-                               {
-                                       continue;
-                               }
-                       }
-
-                       switch( FileInformationClass )
-                       {
-                       case FileBothDirectoryInformation:
-                               
-                               DebugTrace(DEBUG_TRACE_DIRINFO,   " === FileBothDirectoryInformation", 0 );
-                               ThisBlock = sizeof( FILE_BOTH_DIR_INFORMATION );
-                               ThisBlock += PtrDirEntry->name_len*2;
-                               ThisBlock = Ext2QuadAlign( ThisBlock  );
-
-                               if( ( BufferIndex + ThisBlock ) > BufferLength )
-                               {
-                                       //
-                                       //      Next entry won't fit into the buffer...
-                                       //      will have to return... 
-                                       //      :(
-                                       //
-                                       if( BothDirInformation )
-                                               BothDirInformation->NextEntryOffset = 0;
-                                       if( !BytesReturned )
-                                               RC = STATUS_NO_MORE_FILES;
-                                       BufferUsedup = TRUE;
-                                       break;
-                               }
-                                                       
-                               Ext2ReadInode( PtrVCB, PtrDirEntry->inode, PtrInode );
-                               if( !PtrInode )
-                               {
-                                       try_return( RC = STATUS_UNSUCCESSFUL );
-                               }
-
-                               BothDirInformation = ( PFILE_BOTH_DIR_INFORMATION ) ( Buffer + ( BufferIndex ) );
-                               BothDirInformation->EaSize                                      = 0;
-                               BothDirInformation->AllocationSize.QuadPart     = PtrInode->i_blocks * 512;
-                               BothDirInformation->EndOfFile.QuadPart          = PtrInode->i_size;
-                               BothDirInformation->ChangeTime.QuadPart         = 0;
-
-                               BothDirInformation->CreationTime.QuadPart       = ( __int64 ) PtrInode->i_ctime * 10000000;
-                               BothDirInformation->CreationTime.QuadPart       += Ext2GlobalData.TimeDiff.QuadPart;
-
-                               BothDirInformation->LastAccessTime.QuadPart     = Ext2GlobalData.TimeDiff.QuadPart + ( ( __int64 ) PtrInode->i_atime * 10000000 );
-                               BothDirInformation->LastWriteTime.QuadPart      = Ext2GlobalData.TimeDiff.QuadPart + ( ( __int64 )PtrInode->i_mtime * 10000000 );
-
-                               //      Getting the file type...
-                               BothDirInformation->FileAttributes = FILE_ATTRIBUTE_NORMAL;
-                               if( ! Ext2IsModeRegularFile( PtrInode->i_mode ) )
-                               {  
-                                       //      Not a reqular file...
-                                       if( Ext2IsModeDirectory( PtrInode->i_mode) )
-                                       {
-                                               //      Directory...
-                                               BothDirInformation->FileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
-                                       }
-                                       else
-                                       {
-                                               //      Special File...
-                                               //      Treated with respect... ;)
-                                               //
-                                               BothDirInformation->FileAttributes |= ( FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY);
-                                               //      FILE_ATTRIBUTE_DEVICE
-                                       }
-                                       if ( Ext2IsModeHidden( PtrInode->i_mode ) )
-                                       {
-                                               BothDirInformation->FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
-                                       }
-                                       
-                                       if ( Ext2IsModeReadOnly( PtrInode->i_mode ) )
-                                       {
-                                               BothDirInformation->FileAttributes |= FILE_ATTRIBUTE_READONLY;
-                                       }
-                               }
-
-                               BothDirInformation->FileIndex = StartingIndexForSearch;
-                               BothDirInformation->FileNameLength = PtrDirEntry->name_len*2 + 2;
-                               BothDirInformation->ShortNameLength = 0; 
-                               BothDirInformation->ShortName[0] = 0;
-                               
-                               //      Copying out the name as WCHAR null terminated strings
-                               for( j = 0; j< PtrDirEntry->name_len ; j ++ )
-                               {
-                                       //      BothDirInformation->ShortName[ j ] = PtrDirEntry->name[j];
-                                       BothDirInformation->FileName[ j ] = PtrDirEntry->name[j];
-                                       //      if( j < 11 )
-                                       //              BothDirInformation->ShortName[j] = PtrDirEntry->name[j];
-                               }
-
-                               /*
-                               if( j < 11 )
-                               {
-                                       BothDirInformation->ShortNameLength = j * 2 + 2;
-                                       BothDirInformation->ShortName[ j ] = 0;
-                               }
-                               else
-                               {
-                                       BothDirInformation->ShortNameLength = 24;
-                                       BothDirInformation->ShortName[ 11 ] = 0;
-                               }*/
-
-                               BothDirInformation->FileName[ j ]       = 0;
-                               BytesReturned += ThisBlock;
-                               BufferIndex += ThisBlock;
-
-                               if( !ReturnSingleEntry && ( StartingIndexForSearch < ( PtrFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart - 1) ))
-                                       BothDirInformation->NextEntryOffset = ThisBlock;
-                               else
-                                       BothDirInformation->NextEntryOffset = 0;
-                               break;
-
-                       case FileDirectoryInformation:
-                               //      DirectoryInformation
-                               DebugTrace(DEBUG_TRACE_DIRINFO,   " === FileDirectoryInformation", 0 );
-                               ThisBlock = sizeof( FILE_DIRECTORY_INFORMATION );
-                               ThisBlock += PtrDirEntry->name_len*2;
-                               ThisBlock = Ext2QuadAlign( ThisBlock  );
-
-                               if( ( BufferIndex + ThisBlock ) > BufferLength )
-                               {
-                                       //
-                                       //      Next entry won't fit into the buffer...
-                                       //      will have to return... 
-                                       //      :(
-                                       //
-                                       if( DirectoryInformation )
-                                               DirectoryInformation->NextEntryOffset = 0;
-                                       if( !BytesReturned )
-                                               RC = STATUS_NO_MORE_FILES;
-                                       BufferUsedup = TRUE;
-                                       break;
-                               }
-                                                       
-                               Ext2ReadInode( PtrVCB, PtrDirEntry->inode, PtrInode );
-                               if( !PtrInode )
-                               {
-                                       try_return( RC = STATUS_UNSUCCESSFUL );
-                               }
-
-                               DirectoryInformation = ( PFILE_DIRECTORY_INFORMATION ) ( Buffer + ( BufferIndex ) );
-                               DirectoryInformation->AllocationSize.QuadPart   = PtrInode->i_blocks * 512;
-                               DirectoryInformation->EndOfFile.QuadPart                = PtrInode->i_size;
-                               DirectoryInformation->ChangeTime.QuadPart               = 0;
-
-                               DirectoryInformation->CreationTime.QuadPart     = ( __int64 ) PtrInode->i_ctime * 10000000;
-                               DirectoryInformation->CreationTime.QuadPart     += Ext2GlobalData.TimeDiff.QuadPart;
-
-                               DirectoryInformation->LastAccessTime.QuadPart   = Ext2GlobalData.TimeDiff.QuadPart + ( ( __int64 ) PtrInode->i_atime * 10000000 );
-                               DirectoryInformation->LastWriteTime.QuadPart    = Ext2GlobalData.TimeDiff.QuadPart + ( ( __int64 )PtrInode->i_mtime * 10000000 );
-
-                               //      Getting the file type...
-                               DirectoryInformation->FileAttributes = FILE_ATTRIBUTE_NORMAL;
-                               if( ! Ext2IsModeRegularFile( PtrInode->i_mode ) )
-                               {  
-                                       //      Not a reqular file...
-                                       if( Ext2IsModeDirectory( PtrInode->i_mode) )
-                                       {
-                                               //      Directory...
-                                               DirectoryInformation->FileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
-                                       }
-                                       else
-                                       {
-                                               //      Special File...
-                                               //      Treated with respect... ;)
-                                               //
-                                               DirectoryInformation->FileAttributes |= ( FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY);
-                                               //      FILE_ATTRIBUTE_DEVICE
-                                       }
-                                       if ( Ext2IsModeHidden( PtrInode->i_mode ) )
-                                       {
-                                               DirectoryInformation->FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
-                                       }
-                                       
-                                       if ( Ext2IsModeReadOnly( PtrInode->i_mode ) )
-                                       {
-                                               DirectoryInformation->FileAttributes |= FILE_ATTRIBUTE_READONLY;
-                                       }
-                               }
-
-                               DirectoryInformation->FileIndex = StartingIndexForSearch;
-                               DirectoryInformation->FileNameLength = PtrDirEntry->name_len*2 + 2;
-                               
-                               //      Copying out the name as WCHAR null terminated strings
-                               for( j = 0; j< PtrDirEntry->name_len ; j ++ )
-                               {
-                                       DirectoryInformation->FileName[ j ] = PtrDirEntry->name[j];
-                               }
-
-                               DirectoryInformation->FileName[ j ]     = 0;
-                               BytesReturned += ThisBlock;
-                               BufferIndex += ThisBlock;
-
-                               if( !ReturnSingleEntry && ( StartingIndexForSearch < ( PtrFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart - 1) ))
-                                       DirectoryInformation->NextEntryOffset = ThisBlock;
-                               else
-                                       DirectoryInformation->NextEntryOffset = 0;
-                               break;
-
-                       case FileFullDirectoryInformation:
-                               //      FullDirInformation->
-                               DebugTrace(DEBUG_TRACE_DIRINFO,   " === FileFullDirectoryInformation - Not handled", 0 );
-                               try_return();
-                       case FileNamesInformation:
-                               //      NamesInformation->
-                               DebugTrace(DEBUG_TRACE_DIRINFO,   " === FileNamesInformation - Not handled", 0 );
-                               try_return();
-                       default:
-                               DebugTrace(DEBUG_TRACE_DIRINFO,   " === Invalid Dir Info class - Not handled", 0 );
-                               try_return( RC = STATUS_INVALID_INFO_CLASS );
-                       }
-                       if( ReturnSingleEntry )
-                       {
-                               break;
-                       }
-               }//     end of for...
-
-
-
-               if( !BytesReturned && StartingIndexForSearch >= ( PtrFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart) )
-               {
-                       Ext2DeallocateUnicodeString( &PtrCCB->DirectorySearchPattern );
-                       PtrCCB->CurrentByteOffset.QuadPart = 0;
-                       if( FirstTimeQuery )
-                               RC = STATUS_NO_SUCH_FILE;
-                       else
-                               RC = STATUS_NO_MORE_FILES;
-                       try_return();
-               }
-               else if( BytesReturned )
-               {
-                       BothDirInformation->NextEntryOffset = 0;
-               }
-
-               try_exit:       NOTHING;
-       }
-       finally 
-       {
-
-               if( PtrInode )
-               {
-                       DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [DirCtrl]", PtrInode );
-                       ExFreePool( PtrInode );
-               }
-
-               if( PtrBCB )
-               {
-                       CcUnpinData( PtrBCB );
-                       PtrBCB = NULL;
-               }
-               
-               if (PostRequest) 
-               {
-                       if (AcquiredFCB) 
-                       {
-                               Ext2ReleaseResource(&(PtrReqdFCB->MainResource));
-                               DebugTrace(DEBUG_TRACE_MISC,  "*** FCB Released in [DirCtrl]", 0);
-                               DebugTraceState( "FCBMain   AC:0x%LX   SW:0x%LX   EX:0x%LX   [DirCtrl]", 
-                                       PtrReqdFCB->MainResource.ActiveCount, 
-                                       PtrReqdFCB->MainResource.NumberOfExclusiveWaiters, 
-                                       PtrReqdFCB->MainResource.NumberOfSharedWaiters );
-                       }
-
-                       // Map the users buffer and then post the request.
-                       RC = Ext2LockCallersBuffer(PtrIrp, TRUE, BufferLength);
-                       ASSERT(NT_SUCCESS(RC));
-
-                       RC = Ext2PostRequest(PtrIrpContext, PtrIrp);
-
-               }
-               else if (!(PtrIrpContext->IrpContextFlags &
-                                                       EXT2_IRP_CONTEXT_EXCEPTION)) 
-               {
-                       if (AcquiredFCB) 
-                       {
-                               Ext2ReleaseResource(&(PtrReqdFCB->MainResource));
-                               DebugTrace(DEBUG_TRACE_MISC,  "*** FCB Released [DirCtrl]", 0);
-                               DebugTraceState( "FCBMain   AC:0x%LX   SW:0x%LX   EX:0x%LX   [DirCtrl]", 
-                                       PtrReqdFCB->MainResource.ActiveCount, 
-                                       PtrReqdFCB->MainResource.NumberOfExclusiveWaiters, 
-                                       PtrReqdFCB->MainResource.NumberOfSharedWaiters );
-                       }
-
-                       // Complete the request.
-                       PtrIrp->IoStatus.Status = RC;
-                       PtrIrp->IoStatus.Information = BytesReturned;
-
-                       // Free up the Irp Context
-                       Ext2ReleaseIrpContext(PtrIrpContext);
-
-                       // complete the IRP
-                       IoCompleteRequest(PtrIrp, IO_DISK_INCREMENT);
-               }
-               
-               //      Flush the saved BCBs...
-               //      Ext2FlushSavedBCBs ( PtrIrpContext );
-
-       }
-
-       return(RC);
-}
-
-
-
-/*************************************************************************
-*
-* Function: Ext2NotifyChangeDirectory()
-*
-* Description:
-*      Handle the notify request.
-*
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL
-*
-* Return Value: STATUS_SUCCESS/Error
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2NotifyChangeDirectory(
-PtrExt2IrpContext                      PtrIrpContext,
-PIRP                                                   PtrIrp,
-#ifdef _GNU_NTIFS_
-PEXTENDED_IO_STACK_LOCATION            PtrIoStackLocation,
-#else
-PIO_STACK_LOCATION             PtrIoStackLocation,
-#endif
-PFILE_OBJECT                           PtrFileObject,
-PtrExt2FCB                                     PtrFCB,
-PtrExt2CCB                                     PtrCCB)
-{
-       NTSTATUS                                        RC = STATUS_SUCCESS;
-       BOOLEAN                                 CompleteRequest = FALSE;
-       BOOLEAN                                 PostRequest = FALSE;
-       PtrExt2NTRequiredFCB    PtrReqdFCB = NULL;
-       BOOLEAN                                 CanWait = FALSE;
-       ULONG                                           CompletionFilter = 0;
-       BOOLEAN                                 WatchTree = FALSE;
-       PtrExt2VCB                              PtrVCB = NULL;
-       BOOLEAN                                 AcquiredFCB = FALSE;
-
-       try {
-
-               // Validate the sent-in FCB
-               if ((PtrFCB->NodeIdentifier.NodeType == EXT2_NODE_TYPE_VCB) || !(PtrFCB->FCBFlags & EXT2_FCB_DIRECTORY)) {
-                       // We will only allow notify requests on directories.
-                       RC = STATUS_INVALID_PARAMETER;
-                       CompleteRequest = TRUE;
-               }
-
-               PtrReqdFCB = &(PtrFCB->NTRequiredFCB);
-               CanWait = ((PtrIrpContext->IrpContextFlags & EXT2_IRP_CONTEXT_CAN_BLOCK) ? TRUE : FALSE);
-           PtrVCB = PtrFCB->PtrVCB;
-
-               // Acquire the FCB resource shared
-               DebugTrace(DEBUG_TRACE_MISC,   "*** Attempting to acquire FCB Shared[DirCtrl]", 0);
-               DebugTraceState( "FCBMain   AC:0x%LX   SW:0x%LX   EX:0x%LX   [DirCtrl]", PtrReqdFCB->MainResource.ActiveCount, PtrReqdFCB->MainResource.NumberOfExclusiveWaiters, PtrReqdFCB->MainResource.NumberOfSharedWaiters );
-               if (!ExAcquireResourceSharedLite(&(PtrReqdFCB->MainResource), CanWait)) 
-               {
-                       DebugTrace(DEBUG_TRACE_MISC,   "*** FCB Acquisition FAILED [DirCtrl]", 0);
-                       PostRequest = TRUE;
-                       try_return(RC = STATUS_PENDING);
-               }
-               AcquiredFCB = TRUE;
-               DebugTrace(DEBUG_TRACE_MISC,   "*** FCB acquired [DirCtrl]", 0);
-
-               // Obtain some parameters sent by the caller
-               CompletionFilter = PtrIoStackLocation->Parameters.NotifyDirectory.CompletionFilter;
-               WatchTree = (PtrIoStackLocation->Flags & SL_WATCH_TREE ? TRUE : FALSE);
-
-               // If you wish to capture the subject context, you can do so as
-               // follows:
-               // {
-               //              PSECURITY_SUBJECT_CONTEXT SubjectContext;
-               //      SubjectContext = Ext2AllocatePool(PagedPool,
-               //                                                                      sizeof(SECURITY_SUBJECT_CONTEXT) );
-               //              SeCaptureSubjectContext(SubjectContext);
-               //      }
-
-               FsRtlNotifyFullChangeDirectory((PNOTIFY_SYNC)&(PtrVCB->NotifyIRPMutex), &(PtrVCB->NextNotifyIRP), (void *)PtrCCB,
-                                                       (PSTRING)(PtrFCB->FCBName->ObjectName.Buffer), WatchTree, FALSE, CompletionFilter, PtrIrp,
-                                                       NULL,           // Ext2TraverseAccessCheck(...) ?
-                                                       NULL);  // SubjectContext ?
-
-               RC = STATUS_PENDING;
-
-               try_exit:       NOTHING;
-
-       } 
-       finally 
-       {
-
-               if (PostRequest) 
-               {
-                       // Perform appropriate post related processing here
-                       if (AcquiredFCB) 
-                       {
-                               Ext2ReleaseResource(&(PtrReqdFCB->MainResource));
-                               DebugTrace(DEBUG_TRACE_MISC,  "*** FCB Released in DirCtrl", 0);
-                               DebugTraceState( "FCBMain   AC:0x%LX   SW:0x%LX   EX:0x%LX   [DirCtrl]", 
-                                       PtrReqdFCB->MainResource.ActiveCount, 
-                                       PtrReqdFCB->MainResource.NumberOfExclusiveWaiters, 
-                                       PtrReqdFCB->MainResource.NumberOfSharedWaiters );
-
-                               AcquiredFCB = FALSE;
-                       }
-                       RC = Ext2PostRequest(PtrIrpContext, PtrIrp);
-               } 
-               else if (CompleteRequest) 
-               {
-                       PtrIrp->IoStatus.Status = RC;
-                       PtrIrp->IoStatus.Information = 0;
-
-                       // Free up the Irp Context
-                       Ext2ReleaseIrpContext(PtrIrpContext);
-
-                       // complete the IRP
-                       IoCompleteRequest(PtrIrp, IO_DISK_INCREMENT);
-               } else {
-                       // Simply free up the IrpContext since the IRP has been queued
-                       Ext2ReleaseIrpContext(PtrIrpContext);
-               }
-
-               // Release the FCB resources if acquired.
-               if (AcquiredFCB) 
-               {
-                       Ext2ReleaseResource(&(PtrReqdFCB->MainResource));
-                       DebugTrace(DEBUG_TRACE_MISC,  "*** FReleased in [DirCtrl]", 0);
-                       DebugTraceState( "FCBMain   AC:0x%LX   SW:0x%LX   EX:0x%LX   [DirCtrl]", 
-                                       PtrReqdFCB->MainResource.ActiveCount, 
-                                       PtrReqdFCB->MainResource.NumberOfExclusiveWaiters, 
-                                       PtrReqdFCB->MainResource.NumberOfSharedWaiters );
-
-                       AcquiredFCB = FALSE;
-               }
-
-       }
-
-       return(RC);
-}
diff --git a/drivers/filesystems/ext2/src/ext2init.c b/drivers/filesystems/ext2/src/ext2init.c
deleted file mode 100644 (file)
index 4ad2540..0000000
+++ /dev/null
@@ -1,380 +0,0 @@
-/*************************************************************************
-*
-* File: ext2init.c
-*
-* Module: Ext2 File System Driver (Kernel mode execution only)
-*
-* Description:
-*     This file contains the initialization code for the kernel mode
-*     Ext2 FSD module. The DriverEntry() routine is called by the I/O
-*     sub-system to initialize the FSD.
-*
-* Author: Manoj Paul Joseph
-*
-*************************************************************************/
-
-#include                       "ext2fsd.h"
-
-// define the file specific bug-check id
-#define                        EXT2_BUG_CHECK_ID                               EXT2_FILE_INIT
-#define                        DEBUG_LEVEL                                             (DEBUG_TRACE_INIT)
-
-#define                        EXT2_FS_NAME                                    L"\\Ext2fs" // Must match others!
-
-// global variables are declared here
-Ext2Data                                       Ext2GlobalData;
-
-
-/*************************************************************************
-*
-* Function: DriverEntry()
-*
-* Description:
-*      This routine is the standard entry point for all kernel mode drivers.
-*      The routine is invoked at IRQL PASSIVE_LEVEL in the context of a
-*      system worker thread.
-*      All FSD specific data structures etc. are initialized here.
-*
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL
-*
-* Return Value: STATUS_SUCCESS/Error (will cause driver to be unloaded).
-*
-*************************************************************************/
-NTSTATUS NTAPI DriverEntry(
-PDRIVER_OBJECT         DriverObject,           // created by the I/O sub-system
-PUNICODE_STRING        RegistryPath)           // path to the registry key
-{
-       NTSTATUS                RC = STATUS_SUCCESS;
-       UNICODE_STRING  DriverDeviceName;
-
-#if 0
-       Ext2BreakPoint();
-#endif
-
-       try 
-       {
-               try 
-               {
-                       
-                       DebugTrace(DEBUG_TRACE_IRP_ENTRY, "Ext2 File System Driver Entry <<<<<<<", 0);
-                       // initialize the global data structure
-                       RtlZeroMemory(&Ext2GlobalData, sizeof(Ext2GlobalData));
-
-                       // initialize some required fields
-                       Ext2GlobalData.NodeIdentifier.NodeType = EXT2_NODE_TYPE_GLOBAL_DATA;
-                       Ext2GlobalData.NodeIdentifier.NodeSize = sizeof(Ext2GlobalData);
-
-                       // initialize the global data resource and remember the fact that
-                       //      the resource has been initialized
-                       RC = ExInitializeResourceLite(&(Ext2GlobalData.GlobalDataResource));
-                       ASSERT(NT_SUCCESS(RC));
-                       Ext2SetFlag(Ext2GlobalData.Ext2Flags, EXT2_DATA_FLAGS_RESOURCE_INITIALIZED);
-
-                       // keep a ptr to the driver object sent to us by the I/O Mgr
-                       Ext2GlobalData.Ext2DriverObject = DriverObject;
-
-                       // initialize the mounted logical volume list head
-                       InitializeListHead( &( Ext2GlobalData.NextVCB ) );
-
-                       // before we proceed with any more initialization, read in
-                       //      user supplied configurable values ...
-                       // if (!NT_SUCCESS(RC = Ext2ObtainRegistryValues(RegistryPath))) {
-                                       // in your commercial driver implementation, it would be
-                                       //      advisable for your driver to print an appropriate error
-                                       //      message to the system error log before leaving
-                       //              try_return();
-                       //      }
-
-                       // we should have the registry data (if any), allocate zone memory ...
-                       //      This is an example of when FSD implementations try to pre-allocate
-                       //      some fixed amount of memory to avoid internal fragmentation and/or waiting
-                       //      later during run-time ...
-
-#ifdef USE_ZONES
-                       
-                       if (!NT_SUCCESS(RC = Ext2InitializeZones())) 
-                       {
-                               // we failed, print a message and leave ...
-                               try_return();
-                       }
-#endif
-
-                       //
-                       //      Initialize the Thread queue structure...
-                       //
-                       KeInitializeEvent( 
-                               &Ext2GlobalData.ThreadQueue.QueueEvent,
-                               SynchronizationEvent,
-                               FALSE
-                               );
-                       KeInitializeSpinLock( &Ext2GlobalData.ThreadQueue.SpinLock );
-                       InitializeListHead( &Ext2GlobalData.ThreadQueue.ThreadQueueListHead );
-
-                       //
-                       //      Done Initializing...
-                       //      Now Creating a worker thread to handle Worker threads...
-                       //
-                       PsCreateSystemThread( 
-                               &Ext2GlobalData.ThreadQueue.QueueHandlerThread, (ACCESS_MASK) 0L, 
-                               NULL, NULL, NULL, Ext2QueueHandlerThread, NULL );
-
-                       // initialize the IRP major function table, and the fast I/O table
-                       Ext2FsdInitializeFunctionPointers(DriverObject);
-
-                       // create a device object representing the driver itself
-                       //      so that requests can be targeted to the driver ...
-                       //      e.g. for a disk-based FSD, "mount" requests will be sent to
-                       //                this device object by the I/O Manager.
-                       //                For a redirector/server, you may have applications
-                       //                send "special" IOCTL's using this device object ...
-                       RtlInitUnicodeString(&DriverDeviceName, EXT2_FS_NAME);
-                       if (!NT_SUCCESS(RC = IoCreateDevice(
-                                       DriverObject,           // our driver object
-                                       0,                                              // don't need an extension for this object
-                                       &DriverDeviceName,// name - can be used to "open" the driver
-                                                         // see the book for alternate choices
-                                       FILE_DEVICE_DISK_FILE_SYSTEM,
-                                       0,                                              // no special characteristics
-                                                                                       // do not want this as an exclusive device, though you might
-                                       FALSE,
-                                       &(Ext2GlobalData.Ext2DeviceObject)))) 
-                       {
-                               // failed to create a device object, leave ...
-                               try_return();
-                       }
-
-
-
-                       // register the driver with the I/O Manager, pretend as if this is
-                       //      a physical disk based FSD (or in order words, this FSD manages
-                       //      logical volumes residing on physical disk drives)
-                       IoRegisterFileSystem(Ext2GlobalData.Ext2DeviceObject);
-
-                       {
-                               TIME_FIELDS             TimeFields;
-
-                               TimeFields.Day = 1;
-                               TimeFields.Hour = 0;
-                               TimeFields.Milliseconds = 0;
-                               TimeFields.Minute = 0;
-                               TimeFields.Month = 1;
-                               TimeFields.Second = 0;
-                               TimeFields.Weekday = 0;
-                               TimeFields.Year = 1970;
-                               RtlTimeFieldsToTime( &TimeFields, &Ext2GlobalData.TimeDiff );
-
-                               /*
-                               Ext2GlobalData.TimeDiff.QuadPart = 0;
-                               RtlTimeToTimeFields( &Ext2GlobalData.TimeDiff,&TimeFields );
-                               TimeFields.Year = 2002;
-                               RtlTimeFieldsToTime( &TimeFields, &Ext2GlobalData.TimeDiff );
-                               */
-
-                       }
-               }
-               except (EXCEPTION_EXECUTE_HANDLER) 
-               {
-                       // we encountered an exception somewhere, eat it up
-                       RC = GetExceptionCode();
-               }
-
-               try_exit:       NOTHING;
-       }
-       finally 
-       {
-               // start unwinding if we were unsuccessful
-               if (!NT_SUCCESS(RC)) 
-               {
-
-                       // Now, delete any device objects, etc. we may have created
-                       if (Ext2GlobalData.Ext2DeviceObject) 
-                       {
-                               IoDeleteDevice(Ext2GlobalData.Ext2DeviceObject);
-                               Ext2GlobalData.Ext2DeviceObject = NULL;
-                       }
-
-                       // free up any memory we might have reserved for zones/lookaside
-                       //      lists
-                       if (Ext2GlobalData.Ext2Flags & EXT2_DATA_FLAGS_ZONES_INITIALIZED) 
-                       {
-                               Ext2DestroyZones();
-                       }
-
-                       // delete the resource we may have initialized
-                       if (Ext2GlobalData.Ext2Flags & EXT2_DATA_FLAGS_RESOURCE_INITIALIZED) 
-                       {
-                               // un-initialize this resource
-                               ExDeleteResourceLite(&(Ext2GlobalData.GlobalDataResource));
-                               Ext2ClearFlag(Ext2GlobalData.Ext2Flags, EXT2_DATA_FLAGS_RESOURCE_INITIALIZED);
-                       }
-               }
-       }
-
-       return(RC);
-}
-
-/*************************************************************************
-*
-* Function: Ext2FsdInitializeFunctionPointers()
-*
-* Description:
-*      Initialize the IRP... function pointer array in the driver object
-*      structure. Also initialize the fast-io function ptr array ...
-*
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL
-*
-* Return Value: None
-*
-*************************************************************************/
-void NTAPI Ext2FsdInitializeFunctionPointers(
-PDRIVER_OBJECT         DriverObject)           // created by the I/O sub-system
-{
-   PFAST_IO_DISPATCH   PtrFastIoDispatch = NULL;
-       
-       // initialize the function pointers for the IRP major
-       //      functions that this FSD is prepared to  handle ...
-       //      NT Version 4.0 has 28 possible functions that a
-       //      kernel mode driver can handle.
-       //      NT Version 3.51 and before has only 22 such functions,
-       //      of which 18 are typically interesting to most FSD's.
-       
-       //      The only interesting new functions that a FSD might
-       //      want to respond to beginning with Version 4.0 are the
-       //      IRP_MJ_QUERY_QUOTA and the IRP_MJ_SET_QUOTA requests.
-       
-       //      The code below does not handle quota manipulation, neither
-       //      does the NT Version 4.0 operating system (or I/O Manager).
-       //      However, you should be on the lookout for any such new
-       //      functionality that your FSD might have to implement in
-       //      the near future.
-       
-       DriverObject->MajorFunction[IRP_MJ_CREATE]                                      = Ext2Create;
-       DriverObject->MajorFunction[IRP_MJ_CLOSE]                                       = Ext2Close;
-       DriverObject->MajorFunction[IRP_MJ_READ]                                        = Ext2Read;
-       DriverObject->MajorFunction[IRP_MJ_WRITE]                                       = Ext2Write;
-
-       DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION]           = Ext2FileInfo;
-       DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION]                     = Ext2FileInfo;
-
-       DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS]                       = Ext2Flush;
-       // To implement support for querying and modifying volume attributes
-       // (volume information query/set operations), enable initialization
-       // of the following two function pointers and then implement the supporting
-       // functions. Use Chapter 11 in the text to assist you in your efforts.
-       DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = Ext2QueryVolInfo;
-       DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] = Ext2SetVolInfo;
-       DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL]   = Ext2DirControl;
-       // To implement support for file system IOCTL calls, enable initialization
-       // of the following function pointer and implement appropriate support. Use
-       // Chapter 11 in the text to assist you in your efforts.
-       DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = Ext2FileSystemControl;
-       DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL]              = Ext2DeviceControl;
-       DriverObject->MajorFunction[IRP_MJ_SHUTDOWN]                            = Ext2Shutdown;
-       // For byte-range lock support, enable initialization of the following
-       // function pointer and implement appropriate support. Use Chapter 10
-       // in the text to assist you in your efforts.
-       // DriverObject->MajorFunction[IRP_MJ_LOCK_CONTROL]             = Ext2LockControl;
-       DriverObject->MajorFunction[IRP_MJ_CLEANUP]                             = Ext2Cleanup;
-       // If your FSD supports security attributes, you should provide appropriate
-       // dispatch entry points and initialize the function pointers as given below.
-       // DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY]           = Ext2Security;
-       // DriverObject->MajorFunction[IRP_MJ_SET_SECURITY]             = Ext2Security;
-       // If you support extended attributes, you should provide appropriate
-       // dispatch entry points and initialize the function pointers as given below.
-       // DriverObject->MajorFunction[IRP_MJ_QUERY_EA]                         = Ext2ExtendedAttr;
-       // DriverObject->MajorFunction[IRP_MJ_SET_EA]                           = Ext2ExtendedAttr;
-
-       // Now, it is time to initialize the fast-io stuff ...
-/*
-       DriverObject->FastIoDispatch = NULL;
-
-*/
-       PtrFastIoDispatch = DriverObject->FastIoDispatch = &(Ext2GlobalData.Ext2FastIoDispatch);
-       
-       // initialize the global fast-io structure
-       //      NOTE: The fast-io structure has undergone a substantial revision
-       //      in Windows NT Version 4.0. The structure has been extensively expanded.
-       //      Therefore, if your driver needs to work on both V3.51 and V4.0+,
-       //      you will have to be able to distinguish between the two versions at compile time.
-       PtrFastIoDispatch->SizeOfFastIoDispatch = sizeof(FAST_IO_DISPATCH);
-       PtrFastIoDispatch->FastIoCheckIfPossible        = Ext2FastIoCheckIfPossible;
-       PtrFastIoDispatch->FastIoRead                           = Ext2FastIoRead;
-       PtrFastIoDispatch->FastIoWrite                          = Ext2FastIoWrite;
-       PtrFastIoDispatch->FastIoQueryBasicInfo         = Ext2FastIoQueryBasicInfo;
-       PtrFastIoDispatch->FastIoQueryStandardInfo      = Ext2FastIoQueryStdInfo;
-       PtrFastIoDispatch->FastIoLock                           = Ext2FastIoLock;
-       PtrFastIoDispatch->FastIoUnlockSingle           = Ext2FastIoUnlockSingle;
-       PtrFastIoDispatch->FastIoUnlockAll                      = Ext2FastIoUnlockAll;
-       PtrFastIoDispatch->FastIoUnlockAllByKey         = Ext2FastIoUnlockAllByKey;
-       PtrFastIoDispatch->AcquireFileForNtCreateSection = Ext2FastIoAcqCreateSec;
-       PtrFastIoDispatch->ReleaseFileForNtCreateSection = Ext2FastIoRelCreateSec;
-
-       // the remaining are only valid under NT Version 4.0 and later
-#if(_WIN32_WINNT >= 0x0400)
-       PtrFastIoDispatch->FastIoQueryNetworkOpenInfo   = Ext2FastIoQueryNetInfo;
-       PtrFastIoDispatch->AcquireForModWrite           = Ext2FastIoAcqModWrite;
-       PtrFastIoDispatch->ReleaseForModWrite           = Ext2FastIoRelModWrite;
-       PtrFastIoDispatch->AcquireForCcFlush            = Ext2FastIoAcqCcFlush;
-       PtrFastIoDispatch->ReleaseForCcFlush            = Ext2FastIoRelCcFlush;
-
-       // MDL functionality
-       PtrFastIoDispatch->MdlRead                                      = Ext2FastIoMdlRead;
-       PtrFastIoDispatch->MdlReadComplete                      = Ext2FastIoMdlReadComplete;
-       PtrFastIoDispatch->PrepareMdlWrite                      = Ext2FastIoPrepareMdlWrite;
-       PtrFastIoDispatch->MdlWriteComplete                     = Ext2FastIoMdlWriteComplete;
-
-       // although this FSD does not support compressed read/write functionality,
-       //      NTFS does, and if you design a FSD that can provide such functionality,
-       //      you should consider initializing the fast io entry points for reading
-       //      and/or writing compressed data ...
-#endif // (_WIN32_WINNT >= 0x0400)
-
-
-       // last but not least, initialize the Cache Manager callback functions
-       //      which are used in CcInitializeCacheMap()
-       Ext2GlobalData.CacheMgrCallBacks.AcquireForLazyWrite = Ext2AcqLazyWrite;
-       Ext2GlobalData.CacheMgrCallBacks.ReleaseFromLazyWrite = Ext2RelLazyWrite;
-       Ext2GlobalData.CacheMgrCallBacks.AcquireForReadAhead = Ext2AcqReadAhead;
-       Ext2GlobalData.CacheMgrCallBacks.ReleaseFromReadAhead = Ext2RelReadAhead;
-
-       return;
-}
-
-
-VOID NTAPI Ext2QueueHandlerThread( 
-       IN PVOID StartContext )
-{              
-               
-       DebugTrace(DEBUG_TRACE_MISC,   "Ext2QueueHandlerThread!!!", 0);
-               
-       while( 1 )
-       {       
-               KeWaitForSingleObject( &Ext2GlobalData.ThreadQueue.QueueEvent,
-                       Executive, KernelMode, FALSE, (PLARGE_INTEGER)NULL );
-               
-               DebugTrace(DEBUG_TRACE_MISC,   "Ext2QueueHandlerThread Alerted!!!", 0);
-               
-               while( !IsListEmpty( &Ext2GlobalData.ThreadQueue.ThreadQueueListHead ) )
-               {
-                       HANDLE                          ThreadHandle;
-                       PLIST_ENTRY                     PtrEntry = NULL;
-                       PtrExt2IrpContext       PtrIrpContext = NULL;
-
-
-                       PtrEntry = ExInterlockedRemoveHeadList( 
-                               &Ext2GlobalData.ThreadQueue.ThreadQueueListHead, 
-                               &Ext2GlobalData.ThreadQueue.SpinLock );
-                       ASSERT( PtrEntry );
-                       PtrIrpContext = CONTAINING_RECORD( PtrEntry, Ext2IrpContext, ThreadQueueListEntry );
-                       
-                       PsCreateSystemThread( 
-                               &ThreadHandle, (ACCESS_MASK) 0L, 
-                               NULL, NULL, NULL, Ext2CommonDispatch, PtrIrpContext );
-               }
-       }       
-}
diff --git a/drivers/filesystems/ext2/src/fsctrl.c b/drivers/filesystems/ext2/src/fsctrl.c
deleted file mode 100644 (file)
index b5a74fb..0000000
+++ /dev/null
@@ -1,963 +0,0 @@
-/*************************************************************************
-*
-* File: fsctrl.c
-*
-* Module: Ext2 File System Driver (Kernel mode execution only)
-*
-* Description:
-*      Contains code to handle the various File System Control calls.
-*
-* Author: Manoj Paul Joseph
-*
-*
-*************************************************************************/
-
-
-
-#include "ext2fsd.h"
-
-
-
-// define the file specific bug-check id
-#define                        EXT2_BUG_CHECK_ID                               EXT2_FILE_FILE_CONTROL
-#define                        DEBUG_LEVEL                                             (DEBUG_TRACE_FSCTRL)
-
-
-NTSTATUS
-Ext2MountVolume(
-       IN PIRP Irp,
-       IN PIO_STACK_LOCATION IrpSp );
-
-NTSTATUS
-Ext2GetPartitionInfo(
-    IN PDEVICE_OBJECT TargetDeviceObject,
-    IN PPARTITION_INFORMATION PartitionInformation
-    );
-
-NTSTATUS
-Ext2GetDriveLayout(
-    IN PDEVICE_OBJECT TargetDeviceObject,
-    IN PDRIVE_LAYOUT_INFORMATION DriveLayoutInformation,
-       IN int BufferSize
-    );
-
-BOOLEAN
-Ext2PerformVerifyDiskRead(
-    IN PDEVICE_OBJECT TargetDeviceObject,
-    IN PVOID Buffer,
-    IN LONGLONG Lbo,
-    IN ULONG NumberOfBytesToRead
-    );
-
-NTSTATUS Ext2UserFileSystemRequest( 
-       IN PIRP Irp,
-       IN PIO_STACK_LOCATION IrpSp );
-
-
-/*************************************************************************
-*
-* Function: Ext2FileSystemControl
-*
-* Description:
-*      The I/O Manager will invoke this routine to handle a 
-*   File System Control IRP
-*
-* Expected Interrupt Level (for execution) :
-*  
-*      ???
-*
-* Arguments:
-*
-*    DeviceObject - Supplies the volume device object where the
-*                   file exists
-*
-*    Irp - Supplies the Irp being processed
-*
-*
-* Return Value:
-*
-*    NTSTATUS - The FSD status for the IRP
-*
-*************************************************************************/
-NTSTATUS NTAPI
-Ext2FileSystemControl(
-    IN PDEVICE_OBJECT DeviceObject,
-    IN PIRP Irp
-    )
-{
-  
-    NTSTATUS Status = STATUS_SUCCESS;
-       PIO_STACK_LOCATION IrpSp;
-    
-       DebugTrace(DEBUG_TRACE_IRP_ENTRY,   "File System Control IRP Received...", 0);
-               
-       //      Ext2BreakPoint();
-
-       FsRtlEnterFileSystem();
-
-       ASSERT(DeviceObject);
-       ASSERT(Irp);
-
-       //
-    //  Get a pointer to the current Irp stack location
-    //
-    IrpSp = IoGetCurrentIrpStackLocation( Irp );
-       
-
-       if( IrpSp->MinorFunction == IRP_MN_MOUNT_VOLUME )
-       {
-               DebugTrace(DEBUG_TRACE_MOUNT,   "Mount Request Received...", 0);
-               Status = Ext2MountVolume ( Irp, IrpSp );
-               Ext2CompleteRequest( Irp, Status );
-       }
-       else if( IrpSp->MinorFunction == IRP_MN_USER_FS_REQUEST )
-       {
-               DebugTrace(DEBUG_TRACE_FSCTRL,   "IRP_MN_USER_FS_REQUEST received...", 0);
-               Status = Ext2UserFileSystemRequest( Irp, IrpSp );
-               Ext2CompleteRequest( Irp, Status );
-       }
-       else 
-       {
-               if( IrpSp->MinorFunction == IRP_MN_VERIFY_VOLUME )
-               {
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   "IRP_MN_VERIFY_VOLUME received...", 0);
-               }
-               else if( IrpSp->MinorFunction == IRP_MN_LOAD_FILE_SYSTEM )
-               {
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   "IRP_MN_LOAD_FILE_SYSTEM received...", 0);
-               }
-               else
-               {
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   "Unknown Minor IRP code received...", 0);
-               }
-
-               Status = STATUS_INVALID_DEVICE_REQUEST;
-               Ext2CompleteRequest( Irp, Status );
-       }
-       
-       FsRtlExitFileSystem();
-
-    return Status;
-}
-
-
-
-/*************************************************************************
-*
-* Function: Ext2MountVolume()
-*
-* Description:
-*      This routine verifies and mounts the volume; 
-*      Called by FSCTRL IRP handler to attempt a 
-*              volume mount.
-*
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL 
-*
-*
-* Arguments:
-*
-*    Irp - Supplies the Irp being processed
-*       IrpSp - Irp Stack Location pointer
-*
-* Return Value: 
-*
-*   NTSTATUS - The Mount status
-*
-*************************************************************************/
-NTSTATUS
-Ext2MountVolume ( 
-       IN PIRP Irp,
-       IN PIO_STACK_LOCATION IrpSp )
-{
-       
-       //      Volume Parameter Block
-       PVPB PtrVPB;
-
-       //      The target device object
-       PDEVICE_OBJECT TargetDeviceObject = NULL;
-
-       // The new volume device object (to be created if partition is Ext2)
-       PDEVICE_OBJECT PtrVolumeDeviceObject = NULL;
-       
-       //      Return Status
-       NTSTATUS Status = STATUS_UNRECOGNIZED_VOLUME;
-
-       // Number of bytes to read for Volume verification...
-       unsigned long NumberOfBytesToRead = 0;
-       
-       //      Starting Offset for 'read'
-       LONGLONG StartingOffset = 0;
-
-       //      Boot Sector information...
-       PPACKED_BOOT_SECTOR BootSector = NULL;
-       
-       //      Ext2 Super Block information...
-       PEXT2_SUPER_BLOCK SuperBlock = NULL;
-
-       //      Volume Control Block
-       PtrExt2VCB                      PtrVCB = NULL;
-
-       //      The File Object for the root directory
-       PFILE_OBJECT PtrRootFileObject = NULL;
-       
-       //      Flag
-       int WeClearedVerifyRequiredBit;
-       
-       //      Used by a for loop...
-       unsigned int i;
-       
-       //      
-       LARGE_INTEGER VolumeByteOffset;
-
-       unsigned long LogicalBlockSize = 0;
-
-       //      Buffer Control Block
-       PBCB PtrBCB = NULL;
-                       
-       //      Cache Buffer - used for pinned access of volume...
-       PVOID PtrCacheBuffer = NULL;
-       
-       PEXT2_GROUP_DESCRIPTOR  PtrGroupDescriptor = NULL;
-
-       // Inititalising variables
-       
-       PtrVPB = IrpSp->Parameters.MountVolume.Vpb;
-       TargetDeviceObject = IrpSp->Parameters.MountVolume.DeviceObject;
-       
-       try
-       {
-               //
-               //      1. Reading in Volume meta data
-               //
-
-               //      Temporarily clear the DO_VERIFY_VOLUME Flag
-               WeClearedVerifyRequiredBit = 0;
-               if ( Ext2IsFlagOn( PtrVPB->RealDevice->Flags, DO_VERIFY_VOLUME ) ) 
-               {
-            Ext2ClearFlag( PtrVPB->RealDevice->Flags, DO_VERIFY_VOLUME );
-            WeClearedVerifyRequiredBit = 1;
-        }
-
-               //      Allocating memory for reading in Boot Sector...
-               NumberOfBytesToRead = Ext2Align( sizeof( EXT2_SUPER_BLOCK ), TargetDeviceObject->SectorSize );
-               BootSector = Ext2AllocatePool( PagedPool, NumberOfBytesToRead  );
-               RtlZeroMemory( BootSector, NumberOfBytesToRead );
-
-               //      Reading in Boot Sector
-               StartingOffset = 0L;
-               Ext2PerformVerifyDiskRead ( TargetDeviceObject,
-                       BootSector, StartingOffset, NumberOfBytesToRead );
-
-               // Reject a volume that contains fat artifacts
-               
-               DebugTrace(DEBUG_TRACE_MOUNT, "OEM[%s]", BootSector->Oem);
-               if (BootSector->Oem[0])
-               {
-                   try_return();
-               }
-
-               //      Allocating memory for reading in Super Block...
-               
-               SuperBlock = Ext2AllocatePool( PagedPool, NumberOfBytesToRead  );
-               RtlZeroMemory( SuperBlock, NumberOfBytesToRead );
-               StartingOffset = 1024;
-
-               //      Reading in the Super Block...
-               Ext2PerformVerifyDiskRead ( TargetDeviceObject,
-                       SuperBlock, StartingOffset, NumberOfBytesToRead );
-
-               //      Resetting the DO_VERIFY_VOLUME Flag
-               if( WeClearedVerifyRequiredBit ) 
-               {
-                       PtrVPB->RealDevice->Flags |= DO_VERIFY_VOLUME;
-               }
-
-               // Verifying the Super Block..
-               if( SuperBlock->s_magic == EXT2_SUPER_MAGIC )
-               {
-                       //
-                       //      Found a valid super block.
-                       //      No more tests for now.
-                       //      Assuming that this is an ext2 partition...
-                       //      Going ahead with mount.
-                       //
-                       DebugTrace(DEBUG_TRACE_MOUNT,   "Valid Ext2 partition detected\nMounting %s...", SuperBlock->s_volume_name);
-                       //
-                       //      2. Creating a volume device object
-                       //
-               if (!NT_SUCCESS( IoCreateDevice( 
-                                       Ext2GlobalData.Ext2DriverObject,        //      (This) Driver object
-                                       Ext2QuadAlign( sizeof(Ext2VCB) ),       //      Device Extension
-                    NULL,                                                              //      Device Name - no name ;)
-                    FILE_DEVICE_DISK_FILE_SYSTEM,              //      Disk File System
-                    0,                                                                 //      DeviceCharacteristics
-                    FALSE,                                                             //      Not an exclusive device
-                    (PDEVICE_OBJECT *)&PtrVolumeDeviceObject)) //      The Volume Device Object
-                                       ) 
-                       {
-                   try_return();
-                       }
-
-                       //      
-                       //  Our alignment requirement is the larger of the processor alignment requirement
-                       //  already in the volume device object and that in the TargetDeviceObject
-                       //
-
-                       if (TargetDeviceObject->AlignmentRequirement > PtrVolumeDeviceObject->AlignmentRequirement) 
-                       {
-                               PtrVolumeDeviceObject->AlignmentRequirement = TargetDeviceObject->AlignmentRequirement;
-                       }
-                       
-                       //
-                       //      Clearing the Device Initialising Flag
-                       //
-                       Ext2ClearFlag( PtrVolumeDeviceObject->Flags, DO_DEVICE_INITIALIZING);
-
-
-                       //
-                       //      Setting the Stack Size for the newly created Volume Device Object
-                       //
-                       PtrVolumeDeviceObject->StackSize = (CCHAR)(TargetDeviceObject->StackSize + 1);
-                       
-
-                       //
-                       //      3. Creating the link between Target Device Object 
-                       //      and the Volume Device Object via the Volume Parameter Block
-                       //
-                       PtrVPB->DeviceObject = PtrVolumeDeviceObject;
-                       
-                       //      Remembring the Volume parameters in the VPB bock
-                       for( i = 0; i < 16 ; i++ )
-                       {
-                               PtrVPB->VolumeLabel[i] = SuperBlock->s_volume_name[i];
-                               if( SuperBlock->s_volume_name[i] == 0 )
-                                       break;
-                       }
-                       PtrVPB->VolumeLabelLength = i * 2;
-                       PtrVPB->SerialNumber = ((ULONG*)SuperBlock->s_uuid)[0];
-                               
-                       //
-                       //      4. Initialise the Volume Comtrol Block
-                       //
-                       {
-                               LARGE_INTEGER AllocationSize;
-
-                               AllocationSize .QuadPart = 
-                                       ( EXT2_MIN_BLOCK_SIZE << SuperBlock->s_log_block_size ) * 
-                                       SuperBlock->s_blocks_count;
-
-                               Ext2InitializeVCB(
-                                       PtrVolumeDeviceObject, 
-                                       TargetDeviceObject,
-                                       PtrVPB,
-                                       &AllocationSize);
-                               PtrVCB = (PtrExt2VCB)(PtrVolumeDeviceObject->DeviceExtension);
-                               ASSERT( PtrVCB );
-                       }
-
-                       PtrVCB->InodesCount = SuperBlock->s_inodes_count;
-                       PtrVCB->BlocksCount = SuperBlock->s_blocks_count;
-                       PtrVCB->ReservedBlocksCount = SuperBlock->s_r_blocks_count;
-                       PtrVCB->FreeBlocksCount = SuperBlock->s_free_blocks_count;
-                       PtrVCB->FreeInodesCount = SuperBlock->s_free_inodes_count;
-                       PtrVCB->LogBlockSize = SuperBlock->s_log_block_size;
-                       PtrVCB->InodesPerGroup = SuperBlock->s_inodes_per_group;
-                       PtrVCB->BlocksPerGroup = SuperBlock->s_blocks_per_group;
-                       PtrVCB->NoOfGroups = ( SuperBlock->s_blocks_count - SuperBlock->s_first_data_block 
-                                                               + SuperBlock->s_blocks_per_group - 1 ) 
-                                                               / SuperBlock->s_blocks_per_group;
-                       if( SuperBlock->s_rev_level )
-                       {
-                               PtrVCB->InodeSize = SuperBlock->s_inode_size;
-                       }
-                       else
-                       {
-                               PtrVCB->InodeSize = sizeof( EXT2_INODE );
-                       }
-
-                       PtrVCB->PtrGroupDescriptors = Ext2AllocatePool( NonPagedPool, sizeof( Ext2GroupDescriptors ) * PtrVCB->NoOfGroups  );
-                       
-                       RtlZeroMemory( PtrVCB->PtrGroupDescriptors , sizeof( Ext2GroupDescriptors ) * PtrVCB->NoOfGroups );
-
-                       //
-                       //      Attempting to Read in some matadata from the Cache...
-                       //      using pin access...
-                       //
-                       LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-       
-                       //
-                       //      Reading Group Descriptors...
-                       //
-                       if( PtrVCB->LogBlockSize )
-                       {
-                               //      First block contains the descriptors...
-                               VolumeByteOffset.QuadPart = LogicalBlockSize;
-                       }
-                       else
-                       {
-                               //      Second block contains the descriptors...
-                               VolumeByteOffset.QuadPart = LogicalBlockSize * 2;
-                       }
-
-                       NumberOfBytesToRead = PtrVCB->NoOfGroups * sizeof( struct ext2_group_desc );
-                       NumberOfBytesToRead = Ext2Align( NumberOfBytesToRead, LogicalBlockSize );
-
-                       if (!CcMapData( PtrVCB->PtrStreamFileObject,
-                   &VolumeByteOffset,
-                   NumberOfBytesToRead,
-                   TRUE,
-                   &PtrBCB,
-                   &PtrCacheBuffer )) 
-                       {
-                               DebugTrace(DEBUG_TRACE_ERROR,   "Cache read failiure while reading in volume meta data", 0);
-                               try_return( Status = STATUS_INSUFFICIENT_RESOURCES );
-                       }
-                       else
-                       {
-                               //      
-                               //      Saving up Often Used Group Descriptor Information in the VCB...
-                               //
-                               unsigned int DescIndex ;
-
-                               DebugTrace(DEBUG_TRACE_MISC,   "Cache hit while reading in volume meta data", 0);
-                               PtrGroupDescriptor = (PEXT2_GROUP_DESCRIPTOR )PtrCacheBuffer;
-                               for( DescIndex = 0; DescIndex < PtrVCB->NoOfGroups; DescIndex++ )
-                               {
-                                       PtrVCB->PtrGroupDescriptors[ DescIndex ].InodeTablesBlock 
-                                               = PtrGroupDescriptor[ DescIndex ].bg_inode_table;
-
-                                       PtrVCB->PtrGroupDescriptors[ DescIndex ].InodeBitmapBlock 
-                                               = PtrGroupDescriptor[ DescIndex ].bg_inode_bitmap
-                                               ;
-                                       PtrVCB->PtrGroupDescriptors[ DescIndex ].BlockBitmapBlock 
-                                               = PtrGroupDescriptor[ DescIndex ].bg_block_bitmap
-                                               ;
-                                       PtrVCB->PtrGroupDescriptors[ DescIndex ].FreeBlocksCount 
-                                               = PtrGroupDescriptor[ DescIndex ].bg_free_blocks_count;
-
-                                       PtrVCB->PtrGroupDescriptors[ DescIndex ].FreeInodesCount 
-                                               = PtrGroupDescriptor[ DescIndex ].bg_free_inodes_count;
-                               }
-                               CcUnpinData( PtrBCB );
-                               PtrBCB = NULL;
-                       }
-
-                       //
-                       //      5. Creating a Root Directory FCB
-                       //
-                       PtrRootFileObject = IoCreateStreamFileObject(NULL, TargetDeviceObject );
-                       if( !PtrRootFileObject )
-                       {
-                               try_return();
-                       }
-                       //
-                       //      Associate the file stream with the Volume parameter block...
-                       //      I do it now
-                       //
-                       PtrRootFileObject->Vpb = PtrVCB->PtrVPB;
-
-                       PtrRootFileObject->ReadAccess = TRUE;
-                       PtrRootFileObject->WriteAccess = TRUE;
-
-                       {
-                               PtrExt2ObjectName               PtrObjectName;
-                               LARGE_INTEGER ZeroSize;
-
-                               PtrObjectName = Ext2AllocateObjectName();
-                               RtlInitUnicodeString( &PtrObjectName->ObjectName, L"\\" );
-                               Ext2CopyWideCharToUnicodeString( &PtrObjectName->ObjectName, L"\\" );
-
-
-                               ZeroSize.QuadPart = 0;
-                               if ( !NT_SUCCESS( Ext2CreateNewFCB( 
-                                               &PtrVCB->PtrRootDirectoryFCB,   //      Root FCB
-                                               ZeroSize,                       //      AllocationSize,
-                                               ZeroSize,                       //      EndOfFile,
-                                               PtrRootFileObject,              //      The Root Dircetory File Object
-                                               PtrVCB,
-                                               PtrObjectName  )  )  )
-                               {
-                                       try_return();
-                               }
-                               
-
-                               PtrVCB->PtrRootDirectoryFCB->FCBFlags |= EXT2_FCB_DIRECTORY | EXT2_FCB_ROOT_DIRECTORY;
-
-
-                       }
-
-                       PtrVCB->PtrRootDirectoryFCB->DcbFcb.Dcb.PtrDirFileObject = PtrRootFileObject;
-                       PtrVCB->PtrRootDirectoryFCB->INodeNo = EXT2_ROOT_INO;
-                       PtrRootFileObject->SectionObjectPointer = &(PtrVCB->PtrRootDirectoryFCB->NTRequiredFCB.SectionObject);
-                       RtlInitUnicodeString( &PtrRootFileObject->FileName, L"\\" );
-
-                       Ext2InitializeFCBInodeInfo( PtrVCB->PtrRootDirectoryFCB );
-
-                       //      
-                       //      Initiating caching for root directory...
-                       //
-
-                       CcInitializeCacheMap(PtrRootFileObject, 
-                               (PCC_FILE_SIZES)(&(PtrVCB->PtrRootDirectoryFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize)),
-                               TRUE,           // We will utilize pin access for directories
-                               &(Ext2GlobalData.CacheMgrCallBacks), // callbacks
-                               PtrVCB->PtrRootDirectoryFCB );          // The context used in callbacks
-
-
-                       //
-                       //      6. Update the VCB Flags
-                       //
-                       PtrVCB->VCBFlags |= EXT2_VCB_FLAGS_VOLUME_MOUNTED ;     //      | EXT2_VCB_FLAGS_VOLUME_READ_ONLY;
-
-
-                       //
-                       //      7. Mount Success
-                       //
-                       Status = STATUS_SUCCESS;
-                       
-                       {
-                               //
-                               //      This block is for testing....
-                               //      To be removed...
-
-                               /*
-                               EXT2_INODE      Inode ;
-                               Ext2ReadInode( PtrVCB, 100, &Inode );
-                               DebugTrace( DEBUG_TRACE_MISC, "Inode size= %lX [FS Ctrl]", Inode.i_size );
-                               Ext2DeallocInode( NULL, PtrVCB, 0xfb6 );
-                               */
-                       }
-                       
-                       //       ObDereferenceObject( TargetDeviceObject );
-               }
-               else
-               {
-                       DebugTrace(DEBUG_TRACE_MOUNT,   "Failing mount. Partition not Ext2...", 0);
-               }
-
-               try_exit: NOTHING;
-       }
-       finally 
-       {
-               //      Freeing Allocated Memory...
-               if( SuperBlock != NULL )
-               {
-                       DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [FS Ctrl]", SuperBlock );
-                       ExFreePool( SuperBlock );
-               }
-               if( BootSector != NULL )
-               {
-                       DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [FS Ctrl]", BootSector);
-                       ExFreePool( BootSector );
-               }
-
-               // start unwinding if we were unsuccessful
-               if (!NT_SUCCESS( Status )) 
-               {
-                                               
-               }
-       }
-       
-       return Status;
-}
-
-/*************************************************************************
-*
-* Function: Ext2MountVolume()
-*
-* Description:
-*      This routine is used for querying the partition information.
-*
-* Expected Interrupt Level (for execution) :
-*  IRQL_PASSIVE_LEVEL 
-*
-* Arguments:
-*
-*      TargetDeviceObject - The target of the query
-*      PartitionInformation - Receives the result of the query
-*
-* Return Value:
-*
-*      NTSTATUS - The return status for the operation
-*
-*************************************************************************/
-NTSTATUS
-Ext2GetPartitionInfo (
-    IN PDEVICE_OBJECT TargetDeviceObject,
-    IN PPARTITION_INFORMATION PartitionInformation
-    )
-{
-    PIRP Irp;
-    KEVENT *PtrEvent = NULL;
-    NTSTATUS Status;
-    IO_STATUS_BLOCK Iosb;
-
-    //
-    //  Query the partition table
-    //
-       PtrEvent = ( KEVENT * )Ext2AllocatePool( NonPagedPool, Ext2QuadAlign( sizeof( KEVENT ) )  );
-       
-
-
-
-    KeInitializeEvent( PtrEvent, NotificationEvent, FALSE );
-       
-    Irp = IoBuildDeviceIoControlRequest( IOCTL_DISK_GET_PARTITION_INFO,
-                                         TargetDeviceObject,
-                                         NULL,
-                                         0,
-                                         PartitionInformation,
-                                         sizeof(PARTITION_INFORMATION),
-                                         FALSE,
-                                         PtrEvent,
-                                         &Iosb );
-
-    if ( Irp == NULL ) 
-       {
-               DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [FS Ctrl]", PtrEvent);
-               ExFreePool( PtrEvent );
-               return 0;
-    }
-
-    Status = IoCallDriver( TargetDeviceObject, Irp );
-
-    if ( Status == STATUS_PENDING ) {
-
-        (VOID) KeWaitForSingleObject( PtrEvent,
-                                      Executive,
-                                      KernelMode,
-                                      FALSE,
-                                      (PLARGE_INTEGER)NULL );
-
-        Status = Iosb.Status;
-    }
-       DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [FS Ctrl]", PtrEvent);
-       ExFreePool( PtrEvent );
-    return Status;
-}
-
-/*************************************************************************
-*
-* Function: Ext2MountVolume()
-*
-* Description:
-*      This routine is used for querying the Drive Layout Information.
-*
-* Expected Interrupt Level (for execution) :
-*  IRQL_PASSIVE_LEVEL 
-*
-* Arguments:
-*
-*      TargetDeviceObject - The target of the query
-*      PartitionInformation - Receives the result of the query
-*
-* Return Value:
-*
-*      NTSTATUS - The return status for the operation
-*
-*************************************************************************/
-NTSTATUS Ext2GetDriveLayout (
-    IN PDEVICE_OBJECT TargetDeviceObject,
-    IN PDRIVE_LAYOUT_INFORMATION DriveLayoutInformation,
-       IN int BufferSize
-    )
-{
-    PIRP Irp;
-    KEVENT *PtrEvent = NULL;
-    NTSTATUS Status;
-    IO_STATUS_BLOCK Iosb;
-
-    //
-    //  Query the partition table
-    //
-       PtrEvent = ( KEVENT * )Ext2AllocatePool( NonPagedPool, Ext2QuadAlign( sizeof( KEVENT ) )  );
-    KeInitializeEvent( PtrEvent, NotificationEvent, FALSE );
-    Irp = IoBuildDeviceIoControlRequest( IOCTL_DISK_GET_DRIVE_LAYOUT,
-                                         TargetDeviceObject,
-                                         NULL,
-                                         0,
-                                         DriveLayoutInformation,
-                                         BufferSize,
-                                         FALSE,
-                                         PtrEvent,
-                                         &Iosb );
-
-    if ( Irp == NULL ) 
-       {
-               DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [FS Ctrl]", PtrEvent);
-               ExFreePool( PtrEvent );
-               return 0;
-    }
-
-    Status = IoCallDriver( TargetDeviceObject, Irp );
-
-    if ( Status == STATUS_PENDING ) {
-
-        (VOID) KeWaitForSingleObject( PtrEvent,
-                                      Executive,
-                                      KernelMode,
-                                      FALSE,
-                                      (PLARGE_INTEGER)NULL );
-
-        Status = Iosb.Status;
-    }
-       DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [FS Ctrl]", PtrEvent);
-       ExFreePool( PtrEvent );
-    return Status;
-}
-
-
-/*************************************************************************
-*
-* Function: Ext2MountVolume()
-*
-* Description:
-*      This routine is used for performing a verify read...
-*
-* Expected Interrupt Level (for execution) :
-*  IRQL_PASSIVE_LEVEL 
-*
-* Arguments:
-*      TargetDeviceObject - The target of the query
-*      PartitionInformation - Receives the result of the query
-*
-* Return Value:
-*      NTSTATUS - The return status for the operation
-*
-*************************************************************************/
-BOOLEAN Ext2PerformVerifyDiskRead(
-    IN PDEVICE_OBJECT TargetDeviceObject,
-    IN PVOID Buffer,
-    IN LONGLONG Lbo,
-    IN ULONG NumberOfBytesToRead )
-{
-    KEVENT Event;
-    PIRP Irp;
-    LARGE_INTEGER ByteOffset;
-    NTSTATUS Status;
-    IO_STATUS_BLOCK Iosb;
-
-    //
-    //  Initialize the event we're going to use
-    //
-    KeInitializeEvent( &Event, NotificationEvent, FALSE );
-
-    //
-    //  Build the irp for the operation
-    //
-    ByteOffset.QuadPart = Lbo;
-    Irp = IoBuildSynchronousFsdRequest( IRP_MJ_READ,
-                                        TargetDeviceObject,
-                                        Buffer,
-                                        NumberOfBytesToRead,
-                                        &ByteOffset,
-                                        &Event,
-                                        &Iosb );
-
-    if ( Irp == NULL ) 
-       {
-        Status = FALSE;
-    }
-
-    Ext2SetFlag( IoGetNextIrpStackLocation( Irp )->Flags, SL_OVERRIDE_VERIFY_VOLUME );
-
-    //
-    //  Call the device to do the read and wait for it to finish.
-    //
-    Status = IoCallDriver( TargetDeviceObject, Irp );
-    if (Status == STATUS_PENDING) 
-       {
-        (VOID)KeWaitForSingleObject( &Event, Executive, KernelMode, FALSE, (PLARGE_INTEGER)NULL );
-        Status = Iosb.Status;
-    }
-
-    ASSERT(Status != STATUS_VERIFY_REQUIRED);
-
-    //
-    //  Special case this error code because this probably means we used
-    //  the wrong sector size and we want to reject STATUS_WRONG_VOLUME.
-    //
-
-    if (Status == STATUS_INVALID_PARAMETER) 
-       {
-        DbgPrint("Ext2PerformVerifyDiskRead Invalid Param\n");
-        return FALSE;
-    }
-
-    if (Status == STATUS_NO_MEDIA_IN_DEVICE) 
-       {
-        DebugTrace(DEBUG_TRACE_MOUNT, "NO MEDIA in DEVICE!", 0);
-        return FALSE;
-    }
-
-    //
-    //  If it doesn't succeed then either return or raise the error.
-    //
-
-    if (!NT_SUCCESS(Status)) 
-       {
-           DbgPrint("Ext2PerformVerifyDiskRead Fail Status %x\n",Status);
-            return FALSE;
-    }
-
-    //
-    //  And return to our caller
-    //
-    return TRUE;
-}
-
-/*************************************************************************
-*
-* Function: Ext2UserFileSystemRequest()
-*
-* Description:
-*      This routine handles User File System Requests
-*
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL 
-*
-*
-* Arguments:
-*
-*    Irp - Supplies the Irp being processed
-*       IrpSp - Irp Stack Location pointer
-*
-* Return Value: NT_STATUS
-*
-*************************************************************************/
-NTSTATUS Ext2UserFileSystemRequest ( 
-       IN PIRP Irp,
-       IN PIO_STACK_LOCATION IrpSp )
-{
-    NTSTATUS Status = STATUS_INVALID_DEVICE_REQUEST;
-       ULONG FsControlCode;
-
-       IrpSp = IoGetCurrentIrpStackLocation( Irp );
-       
-       try
-       {
-#ifdef _GNU_NTIFS_
-               FsControlCode = ((PEXTENDED_IO_STACK_LOCATION)IrpSp)->Parameters.FileSystemControl.FsControlCode;
-#else
-               FsControlCode = IrpSp->Parameters.FileSystemControl.FsControlCode;
-#endif
-
-               switch ( FsControlCode ) 
-               {
-
-               case FSCTL_REQUEST_OPLOCK_LEVEL_1:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   "FSCTL_REQUEST_OPLOCK_LEVEL_1", 0);
-                       break;
-               case FSCTL_REQUEST_OPLOCK_LEVEL_2:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL ", 0);
-                       break;
-               case FSCTL_REQUEST_BATCH_OPLOCK:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_REQUEST_OPLOCK_LEVEL_2 ", 0);
-                       break;
-               case FSCTL_OPLOCK_BREAK_ACKNOWLEDGE:
-                       DebugTrace(DEBUG_TRACE_MISC,   " FSCTL_OPLOCK_BREAK_ACKNOWLEDGE ", 0);
-                       break;
-               case FSCTL_OPBATCH_ACK_CLOSE_PENDING:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_OPBATCH_ACK_CLOSE_PENDING ", 0);
-                       break;
-               case FSCTL_OPLOCK_BREAK_NOTIFY:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_OPLOCK_BREAK_NOTIFY ", 0);
-                       break;
-               case FSCTL_OPLOCK_BREAK_ACK_NO_2:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_OPLOCK_BREAK_ACK_NO_2 ", 0);
-                       break;
-               case FSCTL_LOCK_VOLUME:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_LOCK_VOLUME ", 0);
-                       break;
-               case FSCTL_UNLOCK_VOLUME:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_UNLOCK_VOLUME ", 0);
-                       break;
-               case FSCTL_DISMOUNT_VOLUME:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_DISMOUNT_VOLUME ", 0);
-                       break;
-               case FSCTL_MARK_VOLUME_DIRTY:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_MARK_VOLUME_DIRTY ", 0);
-                       break;
-               case FSCTL_IS_VOLUME_DIRTY:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_IS_VOLUME_DIRTY ", 0);
-                       break;
-               case FSCTL_IS_VOLUME_MOUNTED:
-                       Status = Ext2VerifyVolume(Irp, IrpSp );
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_IS_VOLUME_MOUNTED ", 0);
-                       break;
-               case FSCTL_IS_PATHNAME_VALID:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_IS_PATHNAME_VALID ", 0);
-                       break;
-               case FSCTL_QUERY_RETRIEVAL_POINTERS:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_QUERY_RETRIEVAL_POINTERS ", 0);
-                       break;
-               case FSCTL_QUERY_FAT_BPB:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_QUERY_FAT_BPB ", 0);
-                       break;
-               case FSCTL_FILESYSTEM_GET_STATISTICS:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_FILESYSTEM_GET_STATISTICS ", 0);
-                       break;
-               case FSCTL_GET_VOLUME_BITMAP:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_GET_VOLUME_BITMAP ", 0);
-                       break;
-               case FSCTL_GET_RETRIEVAL_POINTERS:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_GET_RETRIEVAL_POINTERS ", 0);
-                       break;
-               case FSCTL_MOVE_FILE:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_MOVE_FILE ", 0);
-                       break;
-               case FSCTL_ALLOW_EXTENDED_DASD_IO:
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   " FSCTL_ALLOW_EXTENDED_DASD_IO ", 0);
-                       break;
-               default :
-                       DebugTrace(DEBUG_TRACE_FSCTRL,   "Unknown FSCTRL !!!", 0);
-
-               }
-       }
-       finally
-       {
-
-       }
-       return Status;
-}
-
-
-
-NTSTATUS NTAPI Ext2VerifyVolume (
-       IN PIRP Irp,
-       IN PIO_STACK_LOCATION IrpSp )
-{
-
-       PVPB PtrVPB;
-       
-       PtrVPB = IrpSp->Parameters.VerifyVolume.Vpb;
-       if( IrpSp->FileObject )
-       {
-               PtrVPB = IrpSp->FileObject->Vpb;
-       }
-       if( !PtrVPB )
-       {
-               PtrVPB = IrpSp->Parameters.VerifyVolume.Vpb;
-       }
-
-       if( !PtrVPB )
-       {
-               return STATUS_WRONG_VOLUME;
-       }
-
-
-       if ( Ext2IsFlagOn( PtrVPB->RealDevice->Flags, DO_VERIFY_VOLUME ) ) 
-       {
-               //
-               //      Not doing a verify!
-               //      Just acting as if everyting is fine!
-               //      THis should do for now
-               //
-        Ext2ClearFlag( PtrVPB->RealDevice->Flags, DO_VERIFY_VOLUME );
-               
-       }
-       return STATUS_SUCCESS;
-}
diff --git a/drivers/filesystems/ext2/src/io.c b/drivers/filesystems/ext2/src/io.c
deleted file mode 100644 (file)
index 24d93f7..0000000
+++ /dev/null
@@ -1,535 +0,0 @@
-/*************************************************************************
-*
-* File: io.c
-*
-* Module: Ext2 File System Driver (Kernel mode execution only)
-*
-* Description:
-*      This file contains low level disk io routines.
-*
-* Author: Manoj Paul Joseph
-*
-*
-*************************************************************************/
-
-#include                       "ext2fsd.h"
-
-// define the file specific bug-check id
-#define                        EXT2_BUG_CHECK_ID                               EXT2_FILE_IO
-
-/*************************************************************************
-*
-* Function: Ext2PassDownMultiReadWriteIRP()
-*
-* Description:
-*      pass down multiple read IRPs as Associated IRPs
-*
-* Expected Interrupt Level (for execution) :
-*
-*  ?
-*
-* Return Value: STATUS_SUCCESS / STATUS_PENDING / Error
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2PassDownMultiReadWriteIRP( 
-       PEXT2_IO_RUN                    PtrIoRuns, 
-       UINT                                    Count, 
-       ULONG                                   TotalReadWriteLength,
-       PtrExt2IrpContext               PtrIrpContext,
-       PtrExt2FCB                              PtrFCB,
-       BOOLEAN                                 SynchronousIo)
-{
-       PIRP                            PtrMasterIrp;
-       PIRP                            PtrAssociatedIrp;
-    PIO_STACK_LOCATION PtrIrpSp;
-    PMDL                               PtrMdl;
-       PtrExt2VCB                      PtrVCB;
-       UINT                            i;
-       ULONG                           BufferOffset;
-       PEXT2_IO_CONTEXT        PtrIoContext = NULL;
-       PKEVENT                         PtrSyncEvent = NULL;
-       ULONG                           LogicalBlockSize;
-       ULONG                           ReadWriteLength;
-
-       NTSTATUS RC = STATUS_SUCCESS;
-
-       PtrVCB = PtrFCB->PtrVCB;
-       PtrMasterIrp = PtrIrpContext->Irp;
-       LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-
-       try
-       {
-               if( !SynchronousIo )
-               {
-                       IoMarkIrpPending( PtrIrpContext->Irp );
-                       //      We will be returning STATUS_PENDING...
-               }
-
-               if( !PtrMasterIrp->MdlAddress )
-               {
-                       Ext2LockCallersBuffer( PtrMasterIrp, TRUE, TotalReadWriteLength );
-               }
-
-               if( SynchronousIo )
-               {
-                       PtrSyncEvent = Ext2AllocatePool(NonPagedPool, Ext2QuadAlign( sizeof(KEVENT) )  );
-                       if ( !PtrSyncEvent )
-                       {
-                               RC = STATUS_INSUFFICIENT_RESOURCES;
-                               try_return();
-                       }
-                       KeInitializeEvent( PtrSyncEvent, SynchronizationEvent, FALSE );
-               }
-               //
-               //      Allocate and initialize a completion context
-               //
-               PtrIoContext = Ext2AllocatePool(NonPagedPool, Ext2QuadAlign( sizeof(EXT2_IO_CONTEXT) )  );
-               if ( !PtrIoContext )
-               {
-                       RC = STATUS_INSUFFICIENT_RESOURCES;
-                       try_return();
-               }
-
-               RtlZeroMemory( PtrIoContext, sizeof(EXT2_IO_CONTEXT) );
-               PtrIoContext->Count = Count;
-               PtrIoContext->NodeIdentifier.NodeType = EXT2_NODE_TYPE_IO_CONTEXT;
-               PtrIoContext->NodeIdentifier.NodeSize = sizeof( EXT2_IO_CONTEXT );
-               PtrIoContext->PtrMasterIrp = PtrMasterIrp;
-               PtrIoContext->PtrSyncEvent = PtrSyncEvent;
-               PtrIoContext->ReadWriteLength = TotalReadWriteLength;
-
-               
-
-               for( ReadWriteLength = 0, BufferOffset = 0, i = 0; i < Count; i++, BufferOffset += ReadWriteLength )
-               {
-                       
-                       ReadWriteLength = PtrIoRuns[ i].EndOffset - PtrIoRuns[ i].StartOffset;
-                       
-                       //
-                       //      Allocating an Associated IRP...
-                       //
-                       PtrAssociatedIrp = IoMakeAssociatedIrp( PtrMasterIrp,
-                                       (CCHAR) (PtrVCB->TargetDeviceObject->StackSize + 1 ) );
-                       PtrIoRuns[ i].PtrAssociatedIrp = PtrAssociatedIrp;
-                       ASSERT ( PtrAssociatedIrp );
-                       PtrMasterIrp->AssociatedIrp.IrpCount ++;
-                       
-                       //
-                       //      Allocating a Memory Descriptor List...
-                       //
-                       PtrMdl = IoAllocateMdl( (PCHAR) PtrMasterIrp->UserBuffer + BufferOffset, //     Virtual Address
-                               ReadWriteLength,        FALSE, FALSE, PtrAssociatedIrp );
-                       
-                       //
-                       //      and building a partial MDL...
-                       //
-                       IoBuildPartialMdl( PtrMasterIrp->MdlAddress,
-                               PtrMdl, (PCHAR)PtrMasterIrp->UserBuffer + BufferOffset, ReadWriteLength );
-
-                       //
-                       //      Create an Irp stack location for ourselves...
-                       //
-                       IoSetNextIrpStackLocation( PtrAssociatedIrp );
-                       PtrIrpSp = IoGetCurrentIrpStackLocation( PtrAssociatedIrp );
-
-                       //
-                       //  Setup the Stack location to describe our read.
-                       //
-                       PtrIrpSp->MajorFunction = PtrIrpContext->MajorFunction;
-                       if( PtrIrpContext->MajorFunction == IRP_MJ_READ )
-                       {
-                               PtrIrpSp->Parameters.Read.Length = ReadWriteLength;
-                               PtrIrpSp->Parameters.Read.ByteOffset.QuadPart = 
-                                       PtrIoRuns[i].LogicalBlock * ( LogicalBlockSize );
-                       }
-                       else if( PtrIrpContext->MajorFunction == IRP_MJ_WRITE )
-                       {
-                               PtrIrpSp->Parameters.Write.Length = ReadWriteLength;
-                               PtrIrpSp->Parameters.Write.ByteOffset.QuadPart = 
-                                       PtrIoRuns[i].LogicalBlock * ( LogicalBlockSize );
-                       }
-
-                       //      PtrIrpSp->Parameters.Read.Length = ReadWriteLength;
-                       //      PtrIrpSp->Parameters.Read.ByteOffset.QuadPart = PtrIoRuns[i].LogicalBlock;
-
-
-                       //
-                       //      Setup a completion routine...
-                       //
-                       IoSetCompletionRoutine( PtrAssociatedIrp, 
-                                               SynchronousIo ? 
-                                               Ext2MultiSyncCompletionRoutine : 
-                                               Ext2MultiAsyncCompletionRoutine,
-                                               PtrIoContext, TRUE, TRUE, TRUE );
-
-                       //
-                       //      Initialise the next stack location for the driver below us to use...
-                       //
-                       PtrIrpSp = IoGetNextIrpStackLocation( PtrAssociatedIrp );
-                       PtrIrpSp->MajorFunction = PtrIrpContext->MajorFunction;
-                       if( PtrIrpContext->MajorFunction == IRP_MJ_READ )
-                       {
-                               PtrIrpSp->Parameters.Read.Length = ReadWriteLength;
-                               PtrIrpSp->Parameters.Read.ByteOffset.QuadPart = PtrIoRuns[i].LogicalBlock * ( LogicalBlockSize );
-                       }
-                       else if( PtrIrpContext->MajorFunction == IRP_MJ_WRITE )
-                       {
-                               PtrIrpSp->Parameters.Write.Length = ReadWriteLength;
-                               PtrIrpSp->Parameters.Write.ByteOffset.QuadPart = PtrIoRuns[i].LogicalBlock * ( LogicalBlockSize );
-                       }
-
-                       //      PtrIrpSp->Parameters.Read.Length = ReadWriteLength;
-                       //      PtrIrpSp->Parameters.Read.ByteOffset.QuadPart = 
-                       //              PtrIoRuns[i].LogicalBlock * ( LogicalBlockSize );
-               }
-
-               for( i = 0; i < Count; i++ ) {
-                    // DbgPrint("PASSING DOWN IRP %d TO TARGET DEVICE\n", i);
-                    IoCallDriver( PtrVCB->TargetDeviceObject, PtrIoRuns[ i].PtrAssociatedIrp );
-                }
-
-               if( SynchronousIo )
-               {
-                       //
-                       //      Synchronous IO 
-                       //      Wait for the IO to complete...
-                       //
-                       DbgPrint("DEADLY WAIT (%d)\n", KeGetCurrentIrql());
-                       KeWaitForSingleObject( PtrSyncEvent,
-                               Executive, KernelMode, FALSE, (PLARGE_INTEGER)NULL );
-                        DbgPrint("DEADLY WAIT DONE\n");
-                       try_return();
-               }
-               else
-               {
-                       //      Asynchronous IO...
-                       RC = STATUS_PENDING;
-                       try_return();
-               }
-       
-               try_exit:       NOTHING;
-       }
-       finally 
-       {
-               if( PtrSyncEvent )
-               {
-                       DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [io]", PtrSyncEvent );
-                       ExFreePool( PtrSyncEvent );
-               }
-               if( PtrIoContext && ! ( RC == STATUS_PENDING || RC == STATUS_SUCCESS ) )
-               {
-                       //
-                       //      This means we are getting out of 
-                       //      this function without doing a read
-                       //      due to an error, maybe...
-                       //
-                       DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [io]", PtrIoContext);
-                       ExFreePool( PtrIoContext );
-               }
-       }
-       return(RC);
-}
-
-NTSTATUS NTAPI Ext2PassDownSingleReadWriteIRP(
-       PtrExt2IrpContext       PtrIrpContext,
-       PIRP                            PtrIrp, 
-       PtrExt2VCB                      PtrVCB,
-       LARGE_INTEGER           ByteOffset, 
-       uint32                          ReadWriteLength, 
-       BOOLEAN                         SynchronousIo)
-{
-       NTSTATUS                                RC = STATUS_SUCCESS;
-
-       PEXT2_IO_CONTEXT                PtrIoContext = NULL;
-       PKEVENT                                 PtrSyncEvent = NULL;
-
-       PIO_STACK_LOCATION      PtrIrpNextSp = NULL;
-
-       try
-       {
-               if( !PtrIrp->MdlAddress )
-               {
-                       Ext2LockCallersBuffer( PtrIrp, TRUE, ReadWriteLength );
-               }
-
-
-               if( SynchronousIo )
-               {
-                       PtrSyncEvent = Ext2AllocatePool( NonPagedPool, Ext2QuadAlign( sizeof(KEVENT) )  );
-                       if ( !PtrSyncEvent )
-                       {
-                               RC = STATUS_INSUFFICIENT_RESOURCES;
-                               try_return();
-                       }
-                       KeInitializeEvent( PtrSyncEvent, SynchronizationEvent, FALSE );
-               }
-
-               //
-               //      Allocate and initialize a completion context
-               //
-               PtrIoContext = Ext2AllocatePool(NonPagedPool, Ext2QuadAlign( sizeof(EXT2_IO_CONTEXT) )  );
-               if ( !PtrIoContext )
-               {
-                       RC = STATUS_INSUFFICIENT_RESOURCES;
-                       try_return();
-               }
-
-               RtlZeroMemory( PtrIoContext, sizeof(EXT2_IO_CONTEXT) );
-               PtrIoContext->Count = 1;
-               PtrIoContext->NodeIdentifier.NodeType = EXT2_NODE_TYPE_IO_CONTEXT;
-               PtrIoContext->NodeIdentifier.NodeSize = sizeof( EXT2_IO_CONTEXT );
-               PtrIoContext->PtrMasterIrp = NULL;
-               PtrIoContext->PtrSyncEvent = PtrSyncEvent;
-               PtrIoContext->ReadWriteLength = ReadWriteLength;
-
-               IoSetCompletionRoutine( PtrIrp, 
-                       SynchronousIo ? 
-                       Ext2SingleSyncCompletionRoutine: 
-                       Ext2SingleAsyncCompletionRoutine,
-                       PtrIoContext, TRUE, TRUE, TRUE );
-
-               //
-               //  Setup the next IRP stack location in the associated Irp for the disk
-               //  driver beneath us.
-               //
-               PtrIrpNextSp = IoGetNextIrpStackLocation( PtrIrp );
-
-               //
-               //  Setup the Stack location to do a read from the disk driver.
-               //
-               PtrIrpNextSp->MajorFunction = PtrIrpContext->MajorFunction;
-               if( PtrIrpContext->MajorFunction == IRP_MJ_READ )
-               {
-                       PtrIrpNextSp->Parameters.Read.Length = ReadWriteLength;
-                       PtrIrpNextSp->Parameters.Read.ByteOffset = ByteOffset;
-               }
-               else if( PtrIrpContext->MajorFunction == IRP_MJ_WRITE )
-               {
-                       PtrIrpNextSp->Parameters.Write.Length = ReadWriteLength;
-                       PtrIrpNextSp->Parameters.Write.ByteOffset = ByteOffset;
-               }
-               //
-               //  Issue the read / write request
-               //
-               RC = IoCallDriver(PtrVCB->TargetDeviceObject, PtrIrp);
-
-               if( SynchronousIo )
-               {
-                       //
-                       //      Wait for completion...
-                       //
-                       RC = KeWaitForSingleObject( &PtrIoContext->PtrSyncEvent,
-                                               Executive, KernelMode, FALSE, (PLARGE_INTEGER)NULL );
-
-                       RC = STATUS_SUCCESS;
-               }
-               else
-               {
-                       RC = STATUS_PENDING;
-               }
-
-               try_exit:       NOTHING;
-       }
-       finally 
-       {
-               if( PtrSyncEvent )
-               {
-                       DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [io]", PtrSyncEvent );
-                       ExFreePool( PtrSyncEvent );
-               }
-               if( PtrIoContext && !( RC == STATUS_PENDING || RC == STATUS_SUCCESS ) )
-               {
-                       //
-                       //      This means we are getting out of 
-                       //      this function without doing a read / write
-                       //      due to an error, maybe...
-                       //
-                       DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [io]", PtrIoContext );
-                       ExFreePool( PtrIoContext );
-               }
-       }
-       return RC;
-}
-
-
-/*************************************************************************
-*
-* Function: Ext2SingleSyncCompletionRoutine()
-*
-* Description:
-*      Synchronous I/O Completion Routine
-*
-* Expected Interrupt Level (for execution) :
-*
-*  ?
-*
-* Return Value: NTSTATUS - STATUS_SUCCESS(always)
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2SingleSyncCompletionRoutine(
-    IN PDEVICE_OBJECT DeviceObject,
-    IN PIRP Irp,
-    IN PVOID Contxt
-    )
-{
-       PEXT2_IO_CONTEXT PtrContext = Contxt;
-
-       if( Irp->PendingReturned  )
-               IoMarkIrpPending( Irp );
-       
-       ASSERT( PtrContext );
-       ASSERT( PtrContext->NodeIdentifier.NodeType == EXT2_NODE_TYPE_IO_CONTEXT );
-
-       KeSetEvent( PtrContext->PtrSyncEvent, 0, FALSE );
-       DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [io]", PtrContext );
-       ExFreePool( PtrContext );
-
-       return STATUS_SUCCESS;
-}
-
-/*************************************************************************
-*
-* Function: Ext2SingleAsyncCompletionRoutine()
-*
-* Description:
-*      Asynchronous I/O Completion Routine
-*
-* Expected Interrupt Level (for execution) :
-*
-*  ?
-*
-* Return Value: NTSTATUS - STATUS_SUCCESS(always)
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2SingleAsyncCompletionRoutine(
-    IN PDEVICE_OBJECT DeviceObject,
-    IN PIRP Irp,
-    IN PVOID Contxt
-    )
-{
-       PEXT2_IO_CONTEXT PtrContext = Contxt;
-
-       if( Irp->PendingReturned  )
-               IoMarkIrpPending( Irp );
-       
-       ASSERT( PtrContext );
-       ASSERT( PtrContext->NodeIdentifier.NodeType == EXT2_NODE_TYPE_IO_CONTEXT );
-
-       DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [io]", PtrContext );
-       ExFreePool( PtrContext );
-
-       return STATUS_SUCCESS;
-}
-
-/*************************************************************************
-*
-* Function: Ext2MultiSyncCompletionRoutine()
-*
-* Description:
-*      Synchronous I/O Completion Routine
-*
-* Expected Interrupt Level (for execution) :
-*
-*  ?
-*
-* Return Value: NTSTATUS - STATUS_SUCCESS(always)
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2MultiSyncCompletionRoutine (
-    IN PDEVICE_OBJECT DeviceObject,
-    IN PIRP Irp,
-    IN PVOID Contxt
-    )
-{
-
-       PEXT2_IO_CONTEXT PtrContext = Contxt;
-       ASSERT( PtrContext );
-
-       if( Irp->PendingReturned )
-       {
-               IoMarkIrpPending( Irp );
-       }
-
-       if (!NT_SUCCESS( Irp->IoStatus.Status )) 
-       {
-               PtrContext->PtrMasterIrp->IoStatus.Status = Irp->IoStatus.Status;
-    }
-
-    if (InterlockedDecrement( &PtrContext->Count ) == 0)
-       {
-               if ( NT_SUCCESS( PtrContext->PtrMasterIrp->IoStatus.Status ) )
-               {
-                       PtrContext->PtrMasterIrp->IoStatus.Information = PtrContext->ReadWriteLength;
-               }
-               else
-               {
-                       PtrContext->PtrMasterIrp->IoStatus.Information = 0;
-               }
-
-        KeSetEvent( PtrContext->PtrSyncEvent, 0, FALSE );
-               DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [io]", PtrContext );
-               ExFreePool( PtrContext );
-    }
-
-       //
-       //      The master Irp will be automatically completed 
-       //      when all the associated IRPs are completed
-       //
-       return STATUS_SUCCESS;
-}
-
-/*************************************************************************
-*
-* Function: Ext2MultiAsyncCompletionRoutine()
-*
-* Description:
-*      Asynchronous I/O Completion Routine
-*
-* Expected Interrupt Level (for execution) :
-*
-*  ?
-*
-* Return Value: NTSTATUS - STATUS_SUCCESS(always)
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2MultiAsyncCompletionRoutine (
-    IN PDEVICE_OBJECT DeviceObject,
-    IN PIRP Irp,
-    IN PVOID Contxt
-    )
-{
-
-       PEXT2_IO_CONTEXT PtrContext = Contxt;
-       ASSERT( PtrContext );
-       
-       if( Irp->PendingReturned )
-       {
-               IoMarkIrpPending( Irp );
-       }
-
-       if (!NT_SUCCESS( Irp->IoStatus.Status )) 
-       {
-               PtrContext->PtrMasterIrp->IoStatus.Status = Irp->IoStatus.Status;
-    }
-
-    if (InterlockedDecrement( &PtrContext->Count ) == 0)
-       {
-               if ( NT_SUCCESS( PtrContext->PtrMasterIrp->IoStatus.Status ) )
-               {
-                       PtrContext->PtrMasterIrp->IoStatus.Information = PtrContext->ReadWriteLength;
-               }
-               else
-               {
-                       PtrContext->PtrMasterIrp->IoStatus.Information = 0;
-               }
-               DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [io]", PtrContext );
-               ExFreePool( PtrContext );
-    }
-
-       //
-       //      The master Irp will be automatically completed 
-       //      when all the associated IRPs are completed
-       //      Returning STATUS_SUCCESS to continue postprocessing...
-       //
-       return STATUS_SUCCESS;
-}
diff --git a/drivers/filesystems/ext2/src/metadata.c b/drivers/filesystems/ext2/src/metadata.c
deleted file mode 100644 (file)
index 7a6fb5a..0000000
+++ /dev/null
@@ -1,2828 +0,0 @@
-/*************************************************************************
-*
-* File: metadata.c
-*
-* Module: Ext2 File System Driver (Kernel mode execution only)
-*
-* Description:
-*      Should contain code to handle Ext2 Metadata.
-*
-* Author: Manoj Paul Joseph
-*
-*
-*************************************************************************/
-
-#include                       "ext2fsd.h"
-
-#define                        EXT2_BUG_CHECK_ID                               EXT2_FILE_METADATA_IO
-
-#define                        DEBUG_LEVEL                                             ( DEBUG_TRACE_METADATA )
-
-extern Ext2Data                                        Ext2GlobalData;
-
-/*************************************************************************
-*
-* Function: Ext2ReadInode()
-*
-* Description:
-*
-*      The functions will read in the specifiec inode and return it in a buffer
-*
-* 
-* Expected Interrupt Level (for execution) :
-*
-*  IRQL_PASSIVE_LEVEL 
-*
-*
-* Arguements:
-*
-*
-*
-* Return Value: The Status of the Read IO
-*
-*************************************************************************/
-
-NTSTATUS NTAPI Ext2ReadInode (
-       PtrExt2VCB              PtrVcb,                 //      the Volume Control Block
-       uint32                  InodeNo,                //      The Inode no
-       PEXT2_INODE             PtrInode                //      The Inode Buffer
-       )                                       
-{
-       //      The Status to be returned...
-       NTSTATUS RC = STATUS_SUCCESS;
-
-       //      The Read Buffer Pointer
-       BYTE * PtrPinnedReadBuffer = NULL;
-
-       PEXT2_INODE             PtrTempInode;
-
-       //      Buffer Control Block
-       PBCB PtrBCB = NULL;
-
-       LARGE_INTEGER VolumeByteOffset, TempOffset;
-
-       ULONG LogicalBlockSize = 0;
-
-       ULONG NumberOfBytesToRead = 0;
-       ULONG Difference = 0;
-
-       ULONG GroupNo;
-       int Index;
-
-       try
-       {
-               ASSERT(PtrVcb);
-               ASSERT(PtrVcb->NodeIdentifier.NodeType == EXT2_NODE_TYPE_VCB);
-
-               //      Inode numbers start at 1 and not from 0
-               //      Hence 1 is subtracted from InodeNo to get a zero based index...
-               GroupNo = ( InodeNo - 1 ) / PtrVcb->InodesPerGroup;
-
-               if( GroupNo >= PtrVcb->NoOfGroups )
-               {
-                       DebugTrace(DEBUG_TRACE_MISC,   "&&&&&& Invalid Inode no. Group no %d - too big", GroupNo );
-                       DebugTrace(DEBUG_TRACE_MISC,   "Only %d groups available on disk", PtrVcb->NoOfGroups );
-                       RC = STATUS_UNSUCCESSFUL;
-                       try_return();
-               }
-
-               //if( PtrVcb->InodeTableBlock[ GroupNo ] == 0 )
-               if( PtrVcb->PtrGroupDescriptors[ GroupNo ].InodeTablesBlock == 0 )
-               {
-                       DebugTrace(DEBUG_TRACE_MISC,   "&&&&&& Inode Table Group Invalid - Group no %d ", GroupNo );
-                       RC = STATUS_UNSUCCESSFUL;
-                       try_return();
-               }
-
-               //      Inode numbers start at 1 and not from 0
-               //      Hence 1 is subtracted from InodeNo to get a zero based index...
-               Index = ( InodeNo - 1 ) - ( GroupNo * PtrVcb->InodesPerGroup );
-
-               LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVcb->LogBlockSize;
-               NumberOfBytesToRead = sizeof(EXT2_INODE);       //      LogicalBlockSize;
-
-               VolumeByteOffset.QuadPart = PtrVcb->PtrGroupDescriptors[ GroupNo ].InodeTablesBlock
-                               * LogicalBlockSize + Index * PtrVcb->InodeSize;
-               //VolumeByteOffset.QuadPart = PtrVcb->InodeTableBlock[ GroupNo ] * LogicalBlockSize +
-               //      Index * PtrVcb->InodeSize;
-               
-               TempOffset.QuadPart = Ext2Align64( VolumeByteOffset.QuadPart, LogicalBlockSize );
-               if( TempOffset.QuadPart != VolumeByteOffset.QuadPart )
-               {
-                       //      TempOffset.QuadPart -= LogicalBlockSize;
-                       Difference = (LONG) (VolumeByteOffset.QuadPart - TempOffset.QuadPart + LogicalBlockSize );
-                       VolumeByteOffset.QuadPart -= Difference;
-                       NumberOfBytesToRead += Difference;
-               }
-
-               NumberOfBytesToRead = Ext2Align( NumberOfBytesToRead, LogicalBlockSize );
-
-               if( NumberOfBytesToRead > LogicalBlockSize )
-               {
-                       //      Multiple blocks being read in...
-                       //      Can cause overlap
-                       //      Watch out!!!!
-                       Ext2BreakPoint();
-               }
-
-
-
-               if (!CcMapData( PtrVcb->PtrStreamFileObject,
-                       &VolumeByteOffset,
-                       NumberOfBytesToRead,
-                       TRUE,
-                       &PtrBCB,
-                       (PVOID*)&PtrPinnedReadBuffer )) 
-               {
-                       RC = STATUS_UNSUCCESSFUL;
-                       try_return();
-               }
-               else
-               {
-                       PtrTempInode = (PEXT2_INODE) ( PtrPinnedReadBuffer + Difference );
-                       RtlCopyMemory( PtrInode, PtrTempInode , sizeof(EXT2_INODE) );
-               }
-
-               try_exit:       NOTHING;
-       }
-       finally
-       {
-               if( PtrBCB )
-               {
-                       CcUnpinData( PtrBCB );
-                       PtrBCB = NULL;
-               }
-
-       }
-       return RC;
-}
-
-/*************************************************************************
-*
-* Function: Ext2InitializeFCBInodeInfo()
-*
-* Description:
-*      The functions will initialize the FCB with its i-node info
-*      provided it hasn't been initialized as yet...
-*
-* Expected Interrupt Level (for execution) :
-*  IRQL_PASSIVE_LEVEL 
-*
-* Arguements:
-*      Pointer to FCB
-*
-* Return Value: None
-*
-*************************************************************************/
-void NTAPI Ext2InitializeFCBInodeInfo (
-       PtrExt2FCB      PtrFCB )
-{
-       PtrExt2VCB                      PtrVCB = NULL;
-       EXT2_INODE                      Inode;
-       int i;
-       ULONG LogicalBlockSize;
-
-       PtrVCB = PtrFCB->PtrVCB;
-
-       LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-
-       if( !Ext2IsFlagOn( PtrFCB->FCBFlags, EXT2_FCB_BLOCKS_INITIALIZED ) )
-       {
-               DebugTrace(DEBUG_TRACE_MISC,   "Reading in the i-node no %d", PtrFCB->INodeNo );
-
-               Ext2ReadInode( PtrVCB, PtrFCB->INodeNo, &Inode );       
-                       
-               for( i = 0; i < EXT2_N_BLOCKS ; i++ )
-               {
-                       PtrFCB->IBlock[i] = Inode.i_block[ i ];
-               }
-
-               PtrFCB->CreationTime.QuadPart   = ( __int64 )Inode.i_ctime * 10000000;
-               PtrFCB->CreationTime.QuadPart   += Ext2GlobalData.TimeDiff.QuadPart;
-               PtrFCB->LastAccessTime.QuadPart = Ext2GlobalData.TimeDiff.QuadPart + ( ( __int64 ) Inode.i_atime * 10000000);
-               PtrFCB->LastWriteTime.QuadPart  = Ext2GlobalData.TimeDiff.QuadPart + ( ( __int64 ) Inode.i_mtime * 10000000);
-
-
-               PtrFCB->LinkCount = Inode.i_links_count;
-
-               //      Getting the file type...
-               if( ! Ext2IsModeRegularFile( Inode.i_mode ) )
-               {  
-                       //      Not a reqular file...
-                       if( Ext2IsModeDirectory( Inode.i_mode) )
-                       {
-                               //      Directory...
-                               Ext2SetFlag( PtrFCB->FCBFlags, EXT2_FCB_DIRECTORY );
-                       }
-                       else
-                       {
-                               //      Special File...
-                               //      Treated with respect... ;)
-                               //
-                               Ext2SetFlag( PtrFCB->FCBFlags, EXT2_FCB_SPECIAL_FILE );
-                       }
-
-               }
-               if( Ext2IsModeHidden( Inode.i_mode ) )
-               {
-                       Ext2SetFlag( PtrFCB->FCBFlags, EXT2_FCB_HIDDEN_FILE );
-               }
-               if( Ext2IsModeReadOnly( Inode.i_mode ) )
-               {
-                       Ext2SetFlag( PtrFCB->FCBFlags, EXT2_FCB_READ_ONLY );
-               }
-               
-
-               PtrFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart = Inode.i_size;
-               Ext2SetFlag( PtrFCB->FCBFlags, EXT2_FCB_BLOCKS_INITIALIZED );
-               PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize.QuadPart = Inode.i_blocks * 512;
-
-               if( PtrFCB->IBlock[ EXT2_IND_BLOCK ] )
-               {
-                       PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize.QuadPart -= LogicalBlockSize / 512;
-               }
-               DebugTrace( DEBUG_TRACE_FREE, "Freeing  = %lX [metadata]", Inode );
-       }
-}
-
-/*************************************************************************
-*
-* Function: Ext2AllocInode()
-*
-* Description:
-*      The functions will allocate a new on-disk i-node
-*
-* Expected Interrupt Level (for execution) :
-*  IRQL_PASSIVE_LEVEL 
-*
-*
-* Arguements:
-*      Parent Inode no
-*
-* Return Value: The new i-node no or zero
-*
-*************************************************************************/
-ULONG NTAPI Ext2AllocInode( 
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2VCB                      PtrVCB,
-       ULONG                           ParentINodeNo )
-{
-       ULONG InodeNo = 0;
-
-       //      Buffer Control Block
-       PBCB            PtrBitmapBCB = NULL;
-       BYTE *          PtrBitmapBuffer = NULL;
-
-       LARGE_INTEGER VolumeByteOffset;
-       ULONG LogicalBlockSize = 0;
-       ULONG NumberOfBytesToRead = 0;
-       
-       if( PtrVCB->FreeInodesCount == 0)
-       {
-               //
-               //      No Free Inodes left...
-               //      Fail request...
-               //
-               return 0;
-       }
-
-       try
-       {
-               //      unsigned int DescIndex ;
-               BOOLEAN Found = FALSE;
-               ULONG Block;
-               ULONG GroupNo;
-
-               LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-               
-               for( GroupNo = 0; PtrVCB->NoOfGroups; GroupNo++ )
-               {
-                       if( PtrVCB->PtrGroupDescriptors[ GroupNo ].FreeInodesCount )
-                               break;
-               }
-
-               VolumeByteOffset.QuadPart = 
-                       PtrVCB->PtrGroupDescriptors[ GroupNo ].InodeBitmapBlock * LogicalBlockSize;
-               
-               NumberOfBytesToRead = PtrVCB->InodesCount / PtrVCB->NoOfGroups;
-
-               if( NumberOfBytesToRead % 8 )
-               {
-                       NumberOfBytesToRead = ( NumberOfBytesToRead / 8 ) + 1;
-               }
-               else
-               {
-                       NumberOfBytesToRead = ( NumberOfBytesToRead / 8 ) ;
-               }
-
-               for( Block = 0; !Found && Block < Ext2Align( NumberOfBytesToRead , LogicalBlockSize ); 
-                               Block += LogicalBlockSize, VolumeByteOffset.QuadPart += LogicalBlockSize)
-               {       
-                       //
-                       //      Read in the bitmap block...
-                       //
-                       ULONG i, j;
-                       BYTE Bitmap;
-                       
-                       if( !CcPinRead( PtrVCB->PtrStreamFileObject,
-                                  &VolumeByteOffset,
-                                  LogicalBlockSize, //NumberOfBytesToRead,
-                                  TRUE,
-                                  &PtrBitmapBCB,
-                                  (PVOID*)&PtrBitmapBuffer ) )
-                       {
-                               DebugTrace(DEBUG_TRACE_ERROR,   "Cache read failiure while reading in volume meta data", 0);
-                               return 0;
-                       }
-                       
-                       //
-                       //      Is there a free inode...
-                       //      
-                       for( i = 0; !Found && i < LogicalBlockSize && 
-                                               i + (Block * LogicalBlockSize) < NumberOfBytesToRead; i++ )
-                       {
-                               Bitmap = PtrBitmapBuffer[i];
-                               if( Bitmap != 0xff )
-                               {
-                                       //
-                                       //      Found a free inode...
-                                       for( j = 0; !Found && j < 8; j++ )
-                                       {
-                                               if( ( Bitmap & 0x01 ) == 0 )
-                                               {
-                                                       //
-                                                       //      Found...
-                                                       Found = TRUE;
-
-                                                       //      Inode numbers start at 1 and not from 0
-                                                       //      Hence 1 is addded to j 
-                                                       InodeNo = ( ( ( Block * LogicalBlockSize) + i ) * 8) + j + 1 +
-                                                               ( GroupNo * PtrVCB->InodesPerGroup );
-                                               
-                                                       //      Update the inode on the disk...
-                                                       Bitmap = 1 << j;
-                                                       PtrBitmapBuffer[i] |= Bitmap;
-                                                       
-                                                       CcSetDirtyPinnedData( PtrBitmapBCB, NULL );
-                                                       Ext2SaveBCB( PtrIrpContext, PtrBitmapBCB, PtrVCB->PtrStreamFileObject );
-
-                                                       //
-                                                       //      Should update the bitmaps in the other groups too...
-                                                       //
-                                                       break;
-                                               }
-                                               Bitmap = Bitmap >> 1;
-                                       }
-                               }
-                       }
-                       //
-                       //      Unpin the BCB...
-                       //
-                       if( PtrBitmapBCB )
-                       {
-                               CcUnpinData( PtrBitmapBCB );
-                               PtrBitmapBCB = NULL;
-                       }
-               }
-
-               {
-                       //
-                       //      Updating the Inode count in the Group Descriptor...
-                       //      
-                       PBCB                                    PtrDescriptorBCB = NULL;
-                       PEXT2_GROUP_DESCRIPTOR  PtrGroupDescriptor = NULL;
-
-                       PtrVCB->PtrGroupDescriptors[ GroupNo ].FreeInodesCount--;
-
-                       if( PtrVCB->LogBlockSize )
-                       {
-                               //      First block contains the descriptors...
-                               VolumeByteOffset.QuadPart = LogicalBlockSize;
-                       }
-                       else
-                       {
-                               //      Second block contains the descriptors...
-                               VolumeByteOffset.QuadPart = LogicalBlockSize * 2;
-                       }
-                       NumberOfBytesToRead = PtrVCB->NoOfGroups * sizeof( struct ext2_group_desc );
-                       NumberOfBytesToRead = Ext2Align( NumberOfBytesToRead, LogicalBlockSize );
-
-                       if (!CcPinRead( PtrVCB->PtrStreamFileObject,
-                                  &VolumeByteOffset,
-                                  NumberOfBytesToRead,
-                                  TRUE,
-                                  &PtrDescriptorBCB ,
-                                  (PVOID*)&PtrGroupDescriptor )) 
-                       {
-                               DebugTrace(DEBUG_TRACE_ERROR,   "Cache read failiure while reading in volume meta data", 0);
-                               //
-                               //      Ignore this error...
-                               //      Not fatal...
-                       }
-                       else
-                       {
-                               PtrGroupDescriptor[ GroupNo ].bg_free_inodes_count = 
-                                       PtrVCB->PtrGroupDescriptors[ GroupNo ].FreeInodesCount; 
-                               //
-                               //      Not synchronously flushing this information...
-                               //      Lazy writing will do...
-                               //
-                               CcSetDirtyPinnedData( PtrDescriptorBCB, NULL );
-                               CcUnpinData( PtrDescriptorBCB );
-                               PtrDescriptorBCB = NULL;
-                       }
-               }
-
-
-               //
-               //      Update the Inode count...
-               //      in the Super Block...
-               //
-               {
-                       //      Ext2 Super Block information...
-                       PEXT2_SUPER_BLOCK       PtrSuperBlock = NULL;
-                       PBCB                            PtrSuperBlockBCB = NULL;
-
-                       PtrVCB->FreeInodesCount--;
-                       //      Reading in the super block...
-                       VolumeByteOffset.QuadPart = 1024;
-
-                       //      THis shouldn't be more than a block in size...
-                       NumberOfBytesToRead = Ext2Align( sizeof( EXT2_SUPER_BLOCK ), LogicalBlockSize );
-
-                       if( !CcPinRead( PtrVCB->PtrStreamFileObject,
-                                  &VolumeByteOffset,
-                                  NumberOfBytesToRead,
-                                  TRUE,
-                                  &PtrSuperBlockBCB,
-                                  (PVOID*)&PtrSuperBlock ) )
-                       {
-                               DebugTrace(DEBUG_TRACE_ERROR,   "Cache read failiure while reading in volume meta data", 0);
-                       }
-                       else
-                       {
-                               PtrSuperBlock->s_free_inodes_count = PtrVCB->FreeInodesCount;
-                               CcSetDirtyPinnedData( PtrSuperBlockBCB, NULL );
-                               Ext2SaveBCB( PtrIrpContext, PtrSuperBlockBCB, PtrVCB->PtrStreamFileObject );
-                               if( PtrSuperBlockBCB )
-                               {
-                                       CcUnpinData( PtrSuperBlockBCB );
-                                       PtrSuperBlockBCB = NULL;
-                               }
-                               
-                       }
-               }
-       }
-       finally
-       {
-               if( PtrBitmapBCB )
-               {
-                       CcUnpinData( PtrBitmapBCB );
-                       PtrBitmapBCB = NULL;
-               }
-       }
-       DebugTrace( DEBUG_TRACE_SPECIAL, " Allocating an inode - I-Node no : %ld", InodeNo );
-       
-       return InodeNo;
-
-}
-
-/*************************************************************************
-*
-* Function: Ext2DeallocInode()
-*
-* Description:
-*      The functions will deallocate an i-node 
-*
-* Expected Interrupt Level (for execution) :
-*  IRQL_PASSIVE_LEVEL 
-*
-* Return Value: Success / Failure...
-*
-*************************************************************************/
-BOOLEAN NTAPI Ext2DeallocInode( 
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2VCB                      PtrVCB,
-       ULONG                           INodeNo )
-{
-       BOOLEAN         RC = TRUE;
-       
-       //      Buffer Control Block
-       PBCB            PtrBitmapBCB = NULL;
-       BYTE *          PtrBitmapBuffer = NULL; 
-
-       LARGE_INTEGER VolumeByteOffset;
-       ULONG           LogicalBlockSize = 0;
-       
-       DebugTrace( DEBUG_TRACE_SPECIAL, " Deallocating an inode - I-Node no : %ld", INodeNo );
-
-       try
-       {
-               ULONG   BlockIndex ;
-               ULONG   BitmapIndex;
-               ULONG   GroupNo;
-               BYTE    Bitmap;
-               
-               LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-
-               GroupNo = INodeNo / PtrVCB->InodesPerGroup;
-               INodeNo = INodeNo % PtrVCB->InodesPerGroup;
-
-               BitmapIndex =  (INodeNo-1) / 8;
-               Bitmap = 1 << ( (INodeNo-1) % 8 );
-               BlockIndex = BitmapIndex / LogicalBlockSize;
-               //      Adjusting to index into the Logical block that contains the bitmap
-               BitmapIndex = BitmapIndex - ( BlockIndex * LogicalBlockSize );
-
-               VolumeByteOffset.QuadPart = 
-                       ( PtrVCB->PtrGroupDescriptors[ GroupNo ].InodeBitmapBlock + BlockIndex ) 
-                       * LogicalBlockSize;
-
-               //
-               //      Read in the bitmap block...
-               //
-               if( !CcPinRead( PtrVCB->PtrStreamFileObject,
-                               &VolumeByteOffset,
-                               LogicalBlockSize,       //      Just the block that contains the bitmap will do...
-                               TRUE,                           //      Can Wait...
-                               &PtrBitmapBCB,
-                               (PVOID*)&PtrBitmapBuffer ) )
-               {
-                       //      Unable to Pin the data into the cache...
-                       try_return (RC = FALSE);
-               }
-
-               //
-               //      Locate the inode...
-               //      This inode is in the byte PtrBitmapBuffer[ BitmapIndex ]
-               if( ( PtrBitmapBuffer[ BitmapIndex ] & Bitmap ) == 0)
-               {
-                       //      This shouldn't have been so...
-                       //      The inode was never allocated!
-                       //      How to deallocate something that hasn't been allocated? 
-                       //      Hmmm... ;)
-                       //      Ignore this error...
-                       try_return (RC = TRUE);
-               }
-
-
-               //      Setting the bit for the inode...
-               PtrBitmapBuffer[ BitmapIndex ] &= (~Bitmap);
-
-               //      Update the cache...
-               CcSetDirtyPinnedData( PtrBitmapBCB, NULL );
-
-               //      Save up the BCB for forcing a synchronous write...
-               //      Before completing the IRP...
-               Ext2SaveBCB( PtrIrpContext, PtrBitmapBCB, PtrVCB->PtrStreamFileObject );
-
-
-               if( PtrBitmapBCB )
-               {
-                       CcUnpinData( PtrBitmapBCB );
-                       PtrBitmapBCB = NULL;
-               }
-               
-               {
-                       //
-                       //      Updating the Inode count in the Group Descriptor...
-                       //      
-                       PBCB                                    PtrDescriptorBCB = NULL;
-                       PEXT2_GROUP_DESCRIPTOR  PtrGroupDescriptor = NULL;
-                       ULONG                                   NumberOfBytesToRead = 0;
-
-                       PtrVCB->PtrGroupDescriptors[ GroupNo ].FreeInodesCount++;
-
-                       if( PtrVCB->LogBlockSize )
-                       {
-                               //      First block contains the descriptors...
-                               VolumeByteOffset.QuadPart = LogicalBlockSize;
-                       }
-                       else
-                       {
-                               //      Second block contains the descriptors...
-                               VolumeByteOffset.QuadPart = LogicalBlockSize * 2;
-                       }
-                       NumberOfBytesToRead = PtrVCB->NoOfGroups * sizeof( struct ext2_group_desc );
-                       NumberOfBytesToRead = Ext2Align( NumberOfBytesToRead, LogicalBlockSize );
-
-                       if (!CcPinRead( PtrVCB->PtrStreamFileObject,
-                                  &VolumeByteOffset,
-                                  NumberOfBytesToRead,
-                                  TRUE,
-                                  &PtrDescriptorBCB ,
-                                  (PVOID*)&PtrGroupDescriptor )) 
-                       {
-                               DebugTrace(DEBUG_TRACE_ERROR,   "Cache read failiure while reading in volume meta data", 0);
-                               //
-                               //      Ignore this error...
-                               //      Not fatal...
-                       }
-                       else
-                       {
-                               PtrGroupDescriptor[ GroupNo ].bg_free_inodes_count = 
-                                       PtrVCB->PtrGroupDescriptors[ GroupNo ].FreeInodesCount; 
-                               //
-                               //      Not synchronously flushing this information...
-                               //      Lazy writing will do...
-                               //
-                               CcSetDirtyPinnedData( PtrDescriptorBCB, NULL );
-                               CcUnpinData( PtrDescriptorBCB );
-                               PtrDescriptorBCB = NULL;
-                       }
-               }
-               
-
-               //
-               //      Update the Inode count...
-               //      in the Super Block
-               //      and in the VCB
-               //
-               {
-                       //      Ext2 Super Block information...
-                       PEXT2_SUPER_BLOCK       PtrSuperBlock = NULL;
-                       PBCB                            PtrSuperBlockBCB = NULL;
-                       ULONG                           NumberOfBytesToRead = 0;
-
-                       PtrVCB->FreeInodesCount++;
-
-                       //      Reading in the super block...
-                       VolumeByteOffset.QuadPart = 1024;
-                       NumberOfBytesToRead = Ext2Align( sizeof( EXT2_SUPER_BLOCK ), LogicalBlockSize );
-
-                       if( !CcPinRead( PtrVCB->PtrStreamFileObject,
-                                  &VolumeByteOffset,
-                                  NumberOfBytesToRead,
-                                  TRUE,
-                                  &PtrSuperBlockBCB,
-                                  (PVOID*)&PtrSuperBlock ) )
-                       {
-                               DebugTrace(DEBUG_TRACE_ERROR,   "Cache read failiure while reading in volume meta data", 0);
-                       }
-                       else
-                       {
-                               PtrSuperBlock->s_free_inodes_count = PtrVCB->FreeInodesCount;
-                               CcSetDirtyPinnedData( PtrSuperBlockBCB, NULL );
-                               Ext2SaveBCB( PtrIrpContext, PtrSuperBlockBCB, PtrVCB->PtrStreamFileObject );
-                               if( PtrSuperBlockBCB )
-                               {
-                                       CcUnpinData( PtrSuperBlockBCB );
-                                       PtrSuperBlockBCB = NULL;
-                               }
-                               
-                       }
-               }
-               try_exit:       NOTHING;
-       }
-       finally
-       {
-               if( PtrBitmapBCB )
-               {
-                       CcUnpinData( PtrBitmapBCB );
-                       PtrBitmapBCB = NULL;
-               }
-       }
-       return RC;
-}
-
-/*************************************************************************
-*
-* Function: Ext2WriteInode()
-*
-* Description:
-*      The functions will write an i-node to disk
-*
-* Expected Interrupt Level (for execution) :
-*  IRQL_PASSIVE_LEVEL 
-*
-*
-* Return Value: Success / Failure...
-*
-*************************************************************************/
-NTSTATUS NTAPI Ext2WriteInode(
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2VCB                      PtrVcb,                 //      the Volume Control Block
-       uint32                          InodeNo,                //      The Inode no
-       PEXT2_INODE                     PtrInode                //      The Inode Buffer
-       )                                       
-{
-       //      The Status to be returned...
-       NTSTATUS RC = STATUS_SUCCESS;
-
-       //      The Read Buffer Pointer
-       BYTE * PtrPinnedBuffer = NULL;
-
-       //      Buffer Control Block
-       PBCB PtrBCB = NULL;
-
-       LARGE_INTEGER VolumeByteOffset, TempOffset;
-
-       ULONG LogicalBlockSize = 0;
-       ULONG NumberOfBytesToRead = 0;
-       ULONG Difference = 0;
-       ULONG GroupNo;
-       int Index;
-
-       try
-       {
-               DebugTrace( DEBUG_TRACE_SPECIAL, "Writing and updating an inode - I-Node no : %ld", InodeNo );
-
-               ASSERT(PtrVcb);
-               ASSERT(PtrVcb->NodeIdentifier.NodeType == EXT2_NODE_TYPE_VCB);
-               GroupNo = InodeNo / PtrVcb->InodesPerGroup;
-
-               if( GroupNo >= PtrVcb->NoOfGroups )
-               {
-                       DebugTrace(DEBUG_TRACE_MISC,   "&&&&&& Invalid Inode no. Group no %d - too big", GroupNo );
-                       DebugTrace(DEBUG_TRACE_MISC,   "Only %d groups available on disk", PtrVcb->NoOfGroups );
-                       RC = STATUS_UNSUCCESSFUL;
-                       try_return();
-               }
-
-               if( PtrVcb->PtrGroupDescriptors[ GroupNo ].InodeTablesBlock == 0 )
-               {
-                       DebugTrace(DEBUG_TRACE_MISC,   "&&&&&& Inode Table Group Invalid - Group no %d ", GroupNo );
-                       RC = STATUS_UNSUCCESSFUL;
-                       try_return();
-               }
-
-               Index = ( InodeNo - 1 ) - ( GroupNo * PtrVcb->InodesPerGroup );
-
-               LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVcb->LogBlockSize;
-               NumberOfBytesToRead = sizeof(EXT2_INODE);
-
-               VolumeByteOffset.QuadPart = PtrVcb->PtrGroupDescriptors[ GroupNo ].InodeTablesBlock
-                               * LogicalBlockSize + Index * PtrVcb->InodeSize;
-               
-               TempOffset.QuadPart = Ext2Align64( VolumeByteOffset.QuadPart, LogicalBlockSize );
-               if( TempOffset.QuadPart != VolumeByteOffset.QuadPart )
-               {
-                       //      TempOffset.QuadPart -= LogicalBlockSize;
-                       Difference = (LONG) (VolumeByteOffset.QuadPart - TempOffset.QuadPart + LogicalBlockSize );
-                       VolumeByteOffset.QuadPart -= Difference;
-                       NumberOfBytesToRead += Difference;
-               }
-
-               NumberOfBytesToRead = Ext2Align( NumberOfBytesToRead, LogicalBlockSize );
-
-               if( NumberOfBytesToRead > LogicalBlockSize )
-               {
-                       //      Multiple blocks being read in...
-                       //      Can cause overlap
-                       //      Watch out!!!!
-                       Ext2BreakPoint();
-               }
-
-               if( !CcPinRead( PtrVcb->PtrStreamFileObject,
-                                       &VolumeByteOffset,
-                                       NumberOfBytesToRead,
-                                       TRUE,                   //      Can Wait...
-                                       &PtrBCB,
-                                       (PVOID*)&PtrPinnedBuffer ) )
-               {
-                       RC = STATUS_UNSUCCESSFUL;
-                       try_return();
-               }
-               else
-               {
-                       RtlCopyMemory( PtrPinnedBuffer + Difference, PtrInode, sizeof(EXT2_INODE) );
-                       CcSetDirtyPinnedData( PtrBCB, NULL );
-                       Ext2SaveBCB( PtrIrpContext, PtrBCB, PtrVcb->PtrStreamFileObject );
-               }
-       
-               try_exit:       NOTHING;
-       }
-       finally
-       {
-               if( PtrBCB )
-               {
-                       CcUnpinData( PtrBCB );
-                       PtrBCB = NULL;
-               }
-
-       }
-       return RC;
-}
-
-
-/*************************************************************************
-*
-* Function: Ext2MakeNewDirectoryEntry()
-*
-* Description:
-*      The functions will make a new directory entry in a directory file...
-*
-* Expected Interrupt Level (for execution) :
-*  IRQL_PASSIVE_LEVEL 
-*
-*
-* Return Value: Success / Failure...
-*
-*************************************************************************/
-BOOLEAN NTAPI Ext2MakeNewDirectoryEntry(
-       PtrExt2IrpContext               PtrIrpContext,  //      The Irp context
-       PtrExt2FCB                              PtrParentFCB,   //      Parent Folder FCB
-       PFILE_OBJECT                    PtrFileObject,  //      Parent Folder Object
-       PUNICODE_STRING                 PtrName,                //      New entry's name
-       ULONG                                   Type,                   //      The type of the new entry
-       ULONG                                   NewInodeNo)             //      The inode no of the new entry...
-{
-       PBCB                            PtrLastBlockBCB = NULL;
-       BYTE *                          PtrLastBlock = NULL;
-       EXT2_DIR_ENTRY          DirEntry;
-       PEXT2_DIR_ENTRY         PtrTempDirEntry;
-       
-       ULONG                           BlockNo = 0;
-       ULONG                           i;
-       PtrExt2VCB                      PtrVCB;
-       LARGE_INTEGER           VolumeByteOffset;
-       unsigned long           LogicalBlockSize = 0;
-       BOOLEAN                         RC = FALSE;
-       
-       USHORT  HeaderLength = sizeof( EXT2_DIR_ENTRY );
-       USHORT  NewEntryLength = 0; 
-       USHORT  MinLength       = 0;
-       #define ActualLength (PtrTempDirEntry->rec_len)
-       #define NameLength  (PtrTempDirEntry->name_len)
-
-       try
-       {
-               ASSERT( PtrFileObject );
-
-               DebugTrace( DEBUG_TRACE_SPECIAL, "Making directory entry: %S", PtrName->Buffer );
-
-               PtrVCB = PtrParentFCB->PtrVCB;
-               AssertVCB( PtrVCB);
-
-               HeaderLength = sizeof( EXT2_DIR_ENTRY ) -
-                                                 (sizeof( char ) * EXT2_NAME_LEN);
-               //      1. Setting up the entry...
-               NewEntryLength = sizeof( EXT2_DIR_ENTRY ) - ( sizeof( char ) * ( EXT2_NAME_LEN - (PtrName->Length / 2) ) );
-               //      Length should be a multiplicant of 4
-               NewEntryLength = ((NewEntryLength + 3 ) & 0xfffffffc);
-
-               RtlZeroMemory( &DirEntry, sizeof( EXT2_DIR_ENTRY ) );
-
-               DirEntry.file_type = (BYTE) Type;
-               DirEntry.inode = NewInodeNo;
-               DirEntry.name_len = (BYTE)(PtrName->Length / 2 );       //      Does not include a NULL
-               
-               //      DirEntry.rec_len = (USHORT) NewEntryLength;
-
-               for( i = 0; ; i++ )
-               {
-                       if( i < (ULONG)( PtrName->Length / 2 ) )
-                       {
-                               DirEntry.name[i] = (CHAR) PtrName->Buffer[i];
-                       }
-                       else
-                       {
-                               //DirEntry.name[i] = 0; //      Entry need not be zero terminated...
-                               break;
-                       }
-               }
-
-               //
-               //      2. Read the block in the directory...
-               //      Initiate Caching...
-               if ( PtrFileObject->PrivateCacheMap == NULL )
-               {
-                       CcInitializeCacheMap(
-                               PtrFileObject, 
-                               (PCC_FILE_SIZES)(&(PtrParentFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize)),
-                               TRUE,                                                                   // We utilize pin access for directories
-                               &(Ext2GlobalData.CacheMgrCallBacks),    // callbacks
-                               PtrParentFCB );                                                 // The context used in callbacks
-               }
-
-               LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-               if( PtrParentFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart > 0 )
-               {
-                       BlockNo = (ULONG) ( (PtrParentFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart - 1) / LogicalBlockSize) ;
-               }
-               else
-               {
-                       //      This directory doesn't have any data blocks...
-                       //      Allocate a new block...
-                       if( !Ext2AddBlockToFile( PtrIrpContext, PtrVCB, PtrParentFCB, PtrFileObject, TRUE ) )
-                       {
-                               try_return( RC = FALSE );
-                       }
-                       else
-                       {
-                               //      Bring in the newly allocated block to the cache...
-                               VolumeByteOffset.QuadPart = 0;
-
-                               if( !CcPreparePinWrite( 
-                                       PtrFileObject,
-                                       &VolumeByteOffset,
-                                       LogicalBlockSize,
-                                       TRUE,                   //      Zero out the block...
-                                       TRUE,                   //      Can Wait...
-                                       &PtrLastBlockBCB,
-                                       (PVOID*)&PtrLastBlock ) )
-                               {
-                                       try_return( RC = FALSE );
-                               }
-
-                               DirEntry.rec_len = (USHORT)LogicalBlockSize;
-                               RtlCopyBytes( PtrLastBlock, &DirEntry, NewEntryLength);
-                               CcSetDirtyPinnedData( PtrLastBlockBCB, NULL );
-                               Ext2SaveBCB( PtrIrpContext, PtrLastBlockBCB, PtrFileObject );
-                               try_return( RC = TRUE );
-                       }
-               }
-
-               VolumeByteOffset.QuadPart = BlockNo * LogicalBlockSize;
-               CcMapData(      PtrFileObject,
-                                       &VolumeByteOffset,
-                                       LogicalBlockSize,
-                                       TRUE,
-                                       &PtrLastBlockBCB,
-                                       (PVOID*)&PtrLastBlock );
-
-               for( i = 0 ; i < LogicalBlockSize; )
-               {
-                       PtrTempDirEntry = (PEXT2_DIR_ENTRY) &PtrLastBlock[ i ];
-
-                       MinLength = HeaderLength + NameLength;
-                       MinLength = ( HeaderLength + NameLength + 3 ) & 0xfffffffc;
-
-                       
-                       if( PtrTempDirEntry->rec_len == 0 )
-                       {
-                               if( i == 0 )
-                               {
-                                       //      Must be an empty Block...
-                                       //      Insert here...
-                                       //      ---------------->>>
-                                       
-                                       CcPinMappedData( PtrFileObject,
-                                                                  &VolumeByteOffset,
-                                                                  LogicalBlockSize,
-                                                                  TRUE,
-                                                                  &PtrLastBlockBCB );
-
-                                       DirEntry.rec_len = (USHORT)LogicalBlockSize;
-                                       
-                                       RtlCopyBytes( PtrLastBlock, &DirEntry, NewEntryLength);
-                                       CcSetDirtyPinnedData( PtrLastBlockBCB, NULL );
-                                       Ext2SaveBCB( PtrIrpContext, PtrLastBlockBCB, PtrFileObject );
-                                       try_return( RC = TRUE );
-                               }
-                               else
-                               {
-                                       //      This shouldn't be so...
-                                       //      Something is wrong...
-                                       //      Fail this request...
-                                       try_return( RC = FALSE );
-                               }
-                       }
-                       if( ActualLength - MinLength >= NewEntryLength )
-                       {
-                               //      Insert here...
-                               //      ---------------->
-
-                               //      Getting ready for updation...
-                               CcPinMappedData( PtrFileObject,
-                                                          &VolumeByteOffset,
-                                                          LogicalBlockSize,
-                                                          TRUE,
-                                                          &PtrLastBlockBCB );
-
-
-                               DirEntry.rec_len = ActualLength - MinLength;
-
-                               //      Updating the current last entry
-                               PtrTempDirEntry->rec_len = MinLength;
-                               i += PtrTempDirEntry->rec_len;
-                               
-                               //      Making the new entry...
-                               RtlCopyBytes( (PtrLastBlock + i) , &DirEntry, NewEntryLength);
-                               CcSetDirtyPinnedData( PtrLastBlockBCB, NULL );
-                               Ext2SaveBCB( PtrIrpContext, PtrLastBlockBCB, PtrFileObject );
-                               try_return( RC = TRUE );
-
-                       }
-                       i += PtrTempDirEntry->rec_len;
-               }
-
-               //      Will have to allocate a new block...
-               //      Old block does not have enough space..
-               if( !Ext2AddBlockToFile( PtrIrpContext, PtrVCB, PtrParentFCB, PtrFileObject, TRUE ) )
-               {
-                       try_return( RC = FALSE );
-               }
-               else
-               {
-                       //      unpin the previously pinned block
-                       CcUnpinData( PtrLastBlockBCB );
-                       PtrLastBlockBCB = NULL;
-
-                       //      Bring in the newly allocated block to the cache...
-                       VolumeByteOffset.QuadPart += LogicalBlockSize;
-                       if( !CcPreparePinWrite( 
-                               PtrFileObject,
-                               &VolumeByteOffset,
-                               LogicalBlockSize,
-                               TRUE,                   //      Zero out the block...
-                               TRUE,                   //      Can Wait...
-                               &PtrLastBlockBCB,
-                               (PVOID*)&PtrLastBlock ) )
-                       {
-                               try_return( RC = FALSE );
-                       }
-
-                       DirEntry.rec_len = (USHORT)LogicalBlockSize;
-                       RtlCopyBytes( PtrLastBlock, &DirEntry, NewEntryLength);
-                       CcSetDirtyPinnedData( PtrLastBlockBCB, NULL );
-                       Ext2SaveBCB( PtrIrpContext, PtrLastBlockBCB, PtrFileObject );
-                       try_return( RC = TRUE );
-               }
-               try_exit:       NOTHING;
-       }
-       finally
-       {
-               if( PtrLastBlockBCB )
-               {
-                       CcUnpinData( PtrLastBlockBCB );
-                       PtrLastBlockBCB = NULL;
-               }
-       }
-       if( RC == FALSE )
-       {
-               DebugTrace( DEBUG_TRACE_ERROR, "Failed to making directory entry: %S", PtrName->Buffer );
-       }
-       return RC;
-}
-
-
-BOOLEAN NTAPI Ext2FreeDirectoryEntry(
-       PtrExt2IrpContext               PtrIrpContext,
-       PtrExt2FCB                              PtrParentFCB,
-       PUNICODE_STRING                 PtrName)
-{
-
-       PBCB                            PtrDataBlockBCB = NULL;
-       BYTE *                          PtrDataBlock = NULL;
-       PFILE_OBJECT            PtrFileObject = NULL;
-       LONGLONG                        ByteOffset = 0;
-       PtrExt2VCB                      PtrVCB;
-       LARGE_INTEGER           VolumeByteOffset;
-       unsigned long           LogicalBlockSize = 0;
-       BOOLEAN                         RC = FALSE;
-       
-
-       try
-       {
-               DebugTrace( DEBUG_TRACE_SPECIAL, "Freeing directory entry: %S", PtrName->Buffer );
-
-               PtrVCB = PtrParentFCB->PtrVCB;
-               AssertVCB( PtrVCB);
-               
-               LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-
-               PtrFileObject = PtrParentFCB->DcbFcb.Dcb.PtrDirFileObject;
-               if( PtrFileObject == NULL )
-               {
-                       return FALSE;
-               }
-               
-
-               //
-               //      1. Read the block in the directory...
-               //      Initiate Caching...
-               if ( PtrFileObject->PrivateCacheMap == NULL )
-               {
-                       CcInitializeCacheMap(
-                               PtrFileObject, 
-                               (PCC_FILE_SIZES)(&(PtrParentFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize)),
-                               TRUE,                                                                   // We utilize pin access for directories
-                               &(Ext2GlobalData.CacheMgrCallBacks),    // callbacks
-                               PtrParentFCB );                                                 // The context used in callbacks
-               }
-
-               for( ByteOffset = 0; 
-                        ByteOffset < PtrParentFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart;
-                        ByteOffset += LogicalBlockSize )
-               {
-                       ULONG Index = 0;
-                       PEXT2_DIR_ENTRY PtrDirEntry = NULL;
-
-
-                       VolumeByteOffset.QuadPart = ByteOffset;
-                       
-                       CcPinRead(      PtrFileObject,
-                                               &VolumeByteOffset,
-                                               LogicalBlockSize,
-                                               TRUE,
-                                               &PtrDataBlockBCB,
-                                               (PVOID*)&PtrDataBlock );
-                       while( Index < LogicalBlockSize )
-                       {
-                               ULONG i;
-                               //      Parse...
-                               PtrDirEntry = (PEXT2_DIR_ENTRY) &PtrDataBlock[ Index ];
-                               Index += PtrDirEntry->rec_len;
-
-                               if( PtrDirEntry->inode == 0 )
-                               {
-                                       //      This is a deleted entry...
-                                       continue;
-                               }
-                               if( ( PtrName->Length/2 ) != PtrDirEntry->name_len )
-                                       continue;
-                               for( i = 0; ; i++ )
-                               {
-                                       if( PtrDirEntry->name_len == i )
-                                       {
-                                               //      Remove the entry by setting the inode no to zero
-                                               PtrDirEntry->inode = 0;
-
-                                               //      Update the disk
-                                               CcSetDirtyPinnedData( PtrDataBlockBCB , NULL );
-                                               Ext2SaveBCB( PtrIrpContext, PtrDataBlockBCB, PtrFileObject );
-                                               CcUnpinData( PtrDataBlockBCB );
-                                               PtrDataBlockBCB = NULL;
-
-                                               //      Return to caller...
-                                               try_return( RC = TRUE );
-                                       }
-                                       if( PtrName->Buffer[i] != PtrDirEntry->name[i] )
-                                       {
-                                               break;
-                                       }
-                               }
-                       }
-                       CcUnpinData( PtrDataBlockBCB );
-                       PtrDataBlockBCB = NULL;
-               }
-               try_return( RC = FALSE );
-
-               try_exit:       NOTHING;
-       }
-       finally
-       {
-               if( PtrDataBlockBCB )
-               {
-                       CcUnpinData( PtrDataBlockBCB );
-                       PtrDataBlockBCB = NULL;
-               }
-       }
-       return RC;
-}
-
-/*************************************************************************
-*
-* Function: Ext2AddBlockToFile()
-*
-* Description:
-*      The functions will add a block to a file...
-*      It will update the allocation size but not the file size...
-*
-* Expected Interrupt Level (for execution) :
-*  IRQL_PASSIVE_LEVEL 
-*
-*
-* Return Value: Success / Failure...
-*
-*************************************************************************/
-BOOLEAN NTAPI Ext2AddBlockToFile(
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2VCB                      PtrVCB,
-       PtrExt2FCB                      PtrFCB,
-       PFILE_OBJECT            PtrFileObject,
-       BOOLEAN                         UpdateFileSize)
-{
-       BOOLEAN                 RC = TRUE; 
-
-       ULONG                   NewBlockNo = 0;
-       LARGE_INTEGER   VolumeByteOffset;
-       ULONG                   LogicalBlockSize = 0;
-       ULONG                   NoOfBlocks = 0;
-       EXT2_INODE              Inode;
-
-       ULONG   DirectBlocks = 0;
-       ULONG   SingleIndirectBlocks = 0;
-       ULONG   DoubleIndirectBlocks = 0;
-       ULONG   TripleIndirectBlocks = 0;
-       
-       ULONG   *PtrSIBBuffer = NULL;
-       PBCB    PtrSIBBCB = NULL;
-       ULONG   *PtrDIBBuffer = NULL;
-       PBCB    PtrDIBBCB = NULL;
-
-
-       LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-       DirectBlocks =  EXT2_NDIR_BLOCKS ;
-       SingleIndirectBlocks = LogicalBlockSize / sizeof( ULONG );
-       DoubleIndirectBlocks = SingleIndirectBlocks * LogicalBlockSize / sizeof( ULONG );
-       TripleIndirectBlocks = DoubleIndirectBlocks * LogicalBlockSize / sizeof( ULONG );
-
-       try
-       {
-               if( PtrFCB && PtrFCB->FCBName->ObjectName.Length )
-               {
-                       DebugTrace( DEBUG_TRACE_SPECIAL, "Adding Blocks to file  %S", PtrFCB->FCBName->ObjectName.Buffer );
-               }
-
-               Ext2InitializeFCBInodeInfo( PtrFCB );
-
-               //      Allocate a block...
-               NewBlockNo = Ext2AllocBlock( PtrIrpContext, PtrVCB, 1 );
-
-               if( NewBlockNo == 0 )
-               {
-                       try_return (RC = FALSE );
-               }
-
-               //      No of blocks CURRENTLY allocated...
-               NoOfBlocks = (ULONG) PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize.QuadPart / LogicalBlockSize;
-               
-               
-               if( NoOfBlocks < EXT2_NDIR_BLOCKS )
-               {
-                       //
-                       //      A direct data block will do...
-                       //
-                       
-                       PtrFCB->IBlock[ NoOfBlocks ] = NewBlockNo;
-                       
-                       //      Update the inode...
-                       Ext2ReadInode( PtrVCB, PtrFCB->INodeNo, &Inode  );
-                       Inode.i_block[ NoOfBlocks ] = NewBlockNo;
-                       Inode.i_blocks += ( LogicalBlockSize / 512 );
-                       PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize.QuadPart += LogicalBlockSize;
-                       if( UpdateFileSize )
-                       {
-                               Inode.i_size += LogicalBlockSize;
-                               PtrFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart += LogicalBlockSize;
-                       }
-
-                       
-                       if( PtrFileObject->PrivateCacheMap != NULL)
-                       {
-                               //
-                               //      Caching has been initiated...
-                               //      Let the Cache manager in on these changes...
-                               //      
-                               CcSetFileSizes( PtrFileObject, (PCC_FILE_SIZES)&(PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize));
-                       }
-                       
-                       
-                       //      Updating the inode...
-                       if( NT_SUCCESS( Ext2WriteInode( PtrIrpContext, PtrVCB, PtrFCB->INodeNo, &Inode  ) ) )
-                       {
-                               try_return (RC = TRUE);
-                       }
-                       else
-                       {
-                               try_return (RC = FALSE );
-                       }
-                       
-               }
-               else if( NoOfBlocks < (DirectBlocks + SingleIndirectBlocks) )
-               {
-                       //
-                       //      A single indirect data block will do...
-                       Ext2ReadInode( PtrVCB, PtrFCB->INodeNo, &Inode  );
-
-                       if( PtrFCB->IBlock[ EXT2_IND_BLOCK ] == 0 )
-                       {
-                               //      A Single Indirect block should be allocated as well!!
-                               PtrFCB->IBlock[ EXT2_IND_BLOCK ] = Ext2AllocBlock( PtrIrpContext, PtrVCB, 1 );
-                               if( PtrFCB->IBlock[ EXT2_IND_BLOCK ] == 0 )
-                               {
-                                       try_return (RC = FALSE );
-                               }
-                               Inode.i_blocks += ( LogicalBlockSize / 512 );
-
-                               //      Bring in the new block to the cache
-                               //      Zero it out
-                               VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
-
-                               if( !CcPreparePinWrite( 
-                                       PtrVCB->PtrStreamFileObject,
-                                       &VolumeByteOffset,
-                                       LogicalBlockSize,
-                                       TRUE,                   //      Zero out the block...
-                                       TRUE,                   //      Can Wait...
-                                       &PtrSIBBCB,
-                                       (PVOID*)&PtrSIBBuffer ) )
-                               {
-                                       try_return( RC = FALSE );
-                               }
-                       }
-                       else
-                       {
-                               //       Just bring in the SIB to the cache
-                               
-                               VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
-
-                               if( !CcPinRead( PtrVCB->PtrStreamFileObject,
-                                                       &VolumeByteOffset,
-                                                       LogicalBlockSize,
-                                                       TRUE,                   //      Can Wait...
-                                                       &PtrSIBBCB,
-                                                       (PVOID*)&PtrSIBBuffer ) )
-                               {
-                                       try_return( RC = FALSE );
-                               }
-                       }
-                       
-                       //      Update the inode...
-                       
-                       Inode.i_block[ EXT2_IND_BLOCK ] = PtrFCB->IBlock[ EXT2_IND_BLOCK ];
-                       Inode.i_blocks += ( LogicalBlockSize / 512 );
-                       PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize.QuadPart += LogicalBlockSize;
-                       if( UpdateFileSize )
-                       {
-                               Inode.i_size += LogicalBlockSize;
-                               PtrFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart += LogicalBlockSize;
-                       }
-                       if( PtrFileObject->PrivateCacheMap != NULL)
-                       {
-                               //
-                               //      Caching has been initiated...
-                               //      Let the Cache manager in on these changes...
-                               //      
-                               CcSetFileSizes( PtrFileObject, (PCC_FILE_SIZES)&(PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize));
-                       }
-
-                       if( !NT_SUCCESS( Ext2WriteInode( 
-                               PtrIrpContext, PtrVCB, PtrFCB->INodeNo, &Inode  ) ) )
-                       {
-                               try_return (RC = FALSE );
-                       }
-
-                       
-                       //      Update the SIB...
-                       PtrSIBBuffer[ NoOfBlocks - DirectBlocks ] = NewBlockNo;
-                       CcSetDirtyPinnedData( PtrSIBBCB, NULL );
-                       Ext2SaveBCB( PtrIrpContext, PtrSIBBCB, PtrVCB->PtrStreamFileObject );
-
-                       try_return (RC = TRUE);
-
-               }
-               else if( NoOfBlocks < (DirectBlocks + SingleIndirectBlocks + DoubleIndirectBlocks ) )
-               {
-                       //
-                       //      A double indirect block will do...
-                       //
-                       ULONG SBlockNo;
-                       ULONG BlockNo;
-
-                       Ext2ReadInode( PtrVCB, PtrFCB->INodeNo, &Inode  );
-
-                       if( PtrFCB->IBlock[ EXT2_DIND_BLOCK ] == 0 )
-                       {
-                               //      A double indirect pointer block should be allocated as well!!
-                               PtrFCB->IBlock[ EXT2_DIND_BLOCK ] = Ext2AllocBlock( PtrIrpContext, PtrVCB, 1 );
-                               if( PtrFCB->IBlock[ EXT2_DIND_BLOCK ] == 0 )
-                               {
-                                       try_return (RC = FALSE );
-                               }
-                               Inode.i_blocks += ( LogicalBlockSize / 512 );
-
-                               //      Bring in the new block to the cache
-                               //      Zero it out
-                               VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
-
-                               if( !CcPreparePinWrite( 
-                                       PtrVCB->PtrStreamFileObject,
-                                       &VolumeByteOffset,
-                                       LogicalBlockSize,
-                                       TRUE,                   //      Zero out the block...
-                                       TRUE,                   //      Can Wait...
-                                       &PtrDIBBCB,
-                                       (PVOID*)&PtrDIBBuffer ) )
-                               {
-                                       try_return( RC = FALSE );
-                               }
-                       }
-                       else
-                       {
-                               //       Just bring in the DIB to the cache
-                               
-                               VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
-
-                               if( !CcPinRead( PtrVCB->PtrStreamFileObject,
-                                                       &VolumeByteOffset,
-                                                       LogicalBlockSize,
-                                                       TRUE,                   //      Can Wait...
-                                                       &PtrDIBBCB,
-                                                       (PVOID*)&PtrDIBBuffer ) )
-                               {
-                                       try_return( RC = FALSE );
-                               }
-                       }
-                       
-                       //      See if a single indirect 'pointer' block 
-                       //      should also be allocated...
-                       BlockNo = ( NoOfBlocks - DirectBlocks - SingleIndirectBlocks );
-                       SBlockNo = BlockNo / SingleIndirectBlocks;
-                       if( BlockNo % SingleIndirectBlocks )
-                       {
-                               //      A single indirect 'pointer' block 
-                               //      should also be allocated...
-                               PtrDIBBuffer[SBlockNo] = Ext2AllocBlock( PtrIrpContext, PtrVCB, 1 );
-                               CcSetDirtyPinnedData( PtrDIBBCB, NULL );
-                               VolumeByteOffset.QuadPart = PtrDIBBuffer[SBlockNo] * LogicalBlockSize;
-
-                               Inode.i_blocks += ( LogicalBlockSize / 512 );
-
-                               if( !CcPreparePinWrite( 
-                                       PtrVCB->PtrStreamFileObject,
-                                       &VolumeByteOffset,
-                                       LogicalBlockSize,
-                                       TRUE,                                   //      Zero out the block...
-                                       TRUE,                                   //      Can Wait...
-                                       &PtrSIBBCB,
-                                       (PVOID*)&PtrSIBBuffer ) )
-                               {
-                                       try_return( RC = FALSE );
-                               }
-                       }
-                       else
-                       {
-                               VolumeByteOffset.QuadPart = PtrDIBBuffer[SBlockNo] * LogicalBlockSize;
-                               if( !CcPinRead( PtrVCB->PtrStreamFileObject,
-                                                       &VolumeByteOffset,
-                                                       LogicalBlockSize,
-                                                       TRUE,                           //      Can Wait...
-                                                       &PtrSIBBCB,
-                                                       (PVOID*)&PtrSIBBuffer ) )
-                               {
-                                       try_return( RC = FALSE );
-                               }
-                       }
-                       BlockNo = BlockNo % SingleIndirectBlocks;
-                       
-                       //      Update the inode...
-                       
-                       Inode.i_block[ EXT2_DIND_BLOCK ] = PtrFCB->IBlock[ EXT2_DIND_BLOCK ];
-                       Inode.i_blocks += ( LogicalBlockSize / 512 );
-                       PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize.QuadPart += LogicalBlockSize;
-                       if( UpdateFileSize )
-                       {
-                               Inode.i_size += LogicalBlockSize;
-                               PtrFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart += LogicalBlockSize;
-                       }
-                       if( PtrFileObject->PrivateCacheMap != NULL)
-                       {
-                               //
-                               //      Caching has been initiated...
-                               //      Let the Cache manager in on these changes...
-                               //      
-                               CcSetFileSizes( PtrFileObject, (PCC_FILE_SIZES)&(PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize));
-                       }
-
-                       if( !NT_SUCCESS( Ext2WriteInode( 
-                               PtrIrpContext, PtrVCB, PtrFCB->INodeNo, &Inode  ) ) )
-                       {
-                               try_return (RC = FALSE );
-                       }
-
-                       
-                       //      Update the SIB...
-                       PtrSIBBuffer[ BlockNo ] = NewBlockNo;
-                       CcSetDirtyPinnedData( PtrSIBBCB, NULL );
-                       Ext2SaveBCB( PtrIrpContext, PtrSIBBCB, PtrVCB->PtrStreamFileObject );
-                       Ext2SaveBCB( PtrIrpContext, PtrDIBBCB, PtrVCB->PtrStreamFileObject );
-
-                       try_return (RC = TRUE);
-
-               }
-               else
-               {       
-                       //
-                       //      A Triple Indirect block is required
-                       //
-                       ULONG SBlockNo;
-                       ULONG BlockNo;
-
-                       //      This is not supported as yet...
-                       try_return (RC = FALSE);
-
-                       Ext2ReadInode( PtrVCB, PtrFCB->INodeNo, &Inode  );
-
-                       if( PtrFCB->IBlock[ EXT2_TIND_BLOCK ] == 0 )
-                       {
-                               //      A double indirect pointer block should be allocated as well!!
-                               PtrFCB->IBlock[ EXT2_DIND_BLOCK ] = Ext2AllocBlock( PtrIrpContext, PtrVCB, 1 );
-                               if( PtrFCB->IBlock[ EXT2_DIND_BLOCK ] == 0 )
-                               {
-                                       try_return (RC = FALSE );
-                               }
-                               Inode.i_blocks += ( LogicalBlockSize / 512 );
-
-                               //      Bring in the new block to the cache
-                               //      Zero it out
-                               VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
-
-                               if( !CcPreparePinWrite( 
-                                       PtrVCB->PtrStreamFileObject,
-                                       &VolumeByteOffset,
-                                       LogicalBlockSize,
-                                       TRUE,                   //      Zero out the block...
-                                       TRUE,                   //      Can Wait...
-                                       &PtrDIBBCB,
-                                       (PVOID*)&PtrDIBBuffer ) )
-                               {
-                                       try_return( RC = FALSE );
-                               }
-                       }
-                       else
-                       {
-                               //       Just bring in the DIB to the cache
-                               
-                               VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
-
-                               if( !CcPinRead( PtrVCB->PtrStreamFileObject,
-                                                       &VolumeByteOffset,
-                                                       LogicalBlockSize,
-                                                       TRUE,                   //      Can Wait...
-                                                       &PtrDIBBCB,
-                                                       (PVOID*)&PtrDIBBuffer ) )
-                               {
-                                       try_return( RC = FALSE );
-                               }
-                       }
-                       
-                       //      See if a single indirect 'pointer' block 
-                       //      should also be allocated...
-                       BlockNo = ( NoOfBlocks - DirectBlocks - SingleIndirectBlocks );
-                       SBlockNo = BlockNo / SingleIndirectBlocks;
-                       if( BlockNo % SingleIndirectBlocks )
-                       {
-                               //      A single indirect 'pointer' block 
-                               //      should also be allocated...
-                               PtrDIBBuffer[SBlockNo] = Ext2AllocBlock( PtrIrpContext, PtrVCB, 1 );
-                               CcSetDirtyPinnedData( PtrDIBBCB, NULL );
-                               VolumeByteOffset.QuadPart = PtrDIBBuffer[SBlockNo] * LogicalBlockSize;
-
-                               Inode.i_blocks += ( LogicalBlockSize / 512 );
-
-                               if( !CcPreparePinWrite( 
-                                       PtrVCB->PtrStreamFileObject,
-                                       &VolumeByteOffset,
-                                       LogicalBlockSize,
-                                       TRUE,                   //      Zero out the block...
-                                       TRUE,                   //      Can Wait...
-                                       &PtrSIBBCB,
-                                       (PVOID*)&PtrSIBBuffer ) )
-                               {
-                                       try_return( RC = FALSE );
-                               }
-                       }
-                       else
-                       {
-                               VolumeByteOffset.QuadPart = PtrDIBBuffer[SBlockNo] * LogicalBlockSize;
-                               if( !CcPinRead( PtrVCB->PtrStreamFileObject,
-                                                       &VolumeByteOffset,
-                                                       LogicalBlockSize,
-                                                       TRUE,                   //      Can Wait...
-                                                       &PtrSIBBCB,
-                                                       (PVOID*)&PtrSIBBuffer ) )
-                               {
-                                       try_return( RC = FALSE );
-                               }
-                       }
-                       BlockNo = BlockNo % SingleIndirectBlocks;
-                       
-                       //      Update the inode...
-                       
-                       Inode.i_block[ EXT2_DIND_BLOCK ] = PtrFCB->IBlock[ EXT2_DIND_BLOCK ];
-                       Inode.i_blocks += ( LogicalBlockSize / 512 );
-                       PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize.QuadPart += LogicalBlockSize;
-                       if( UpdateFileSize )
-                       {
-                               Inode.i_size += LogicalBlockSize;
-                               PtrFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart += LogicalBlockSize;
-                       }
-                       if( PtrFileObject->PrivateCacheMap != NULL)
-                       {
-                               //
-                               //      Caching has been initiated...
-                               //      Let the Cache manager in on these changes...
-                               //      
-                               CcSetFileSizes( PtrFileObject, (PCC_FILE_SIZES)&(PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize));
-                       }
-
-                       if( !NT_SUCCESS( Ext2WriteInode( 
-                               PtrIrpContext, PtrVCB, PtrFCB->INodeNo, &Inode  ) ) )
-                       {
-                               try_return (RC = FALSE );
-                       }
-
-                       
-                       //      Update the SIB...
-                       PtrSIBBuffer[ BlockNo ] = NewBlockNo;
-                       CcSetDirtyPinnedData( PtrSIBBCB, NULL );
-                       Ext2SaveBCB( PtrIrpContext, PtrSIBBCB, PtrVCB->PtrStreamFileObject );
-                       Ext2SaveBCB( PtrIrpContext, PtrDIBBCB, PtrVCB->PtrStreamFileObject );
-
-                       try_return (RC = TRUE);
-
-               }
-
-               try_exit:       NOTHING;
-       }
-       finally
-       {
-               if( PtrSIBBCB )
-               {
-                       CcUnpinData( PtrSIBBCB );
-                       PtrSIBBCB = NULL;
-               }
-               if( PtrDIBBCB )
-               {
-                       CcUnpinData( PtrDIBBCB );
-                       PtrDIBBCB = NULL;
-               }
-       }
-       return RC;
-}
-
-/*************************************************************************
-*
-* Function: Ext2AllocBlock()
-*
-* Description:
-*      The functions will allocate a new block 
-*
-* Expected Interrupt Level (for execution) :
-*  IRQL_PASSIVE_LEVEL 
-*
-*
-* Return Value: Success / Failure...
-*
-*************************************************************************/
-ULONG NTAPI Ext2AllocBlock( 
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2VCB                      PtrVCB,
-       ULONG                           Count)
-{
-       //      Buffer Control Block
-       PBCB                    PtrBitmapBCB = NULL;
-       BYTE *                  PtrBitmapBuffer = NULL;
-       ULONG                   BlockNo = 0;
-       LARGE_INTEGER   VolumeByteOffset;
-       ULONG                   LogicalBlockSize = 0;
-       ULONG                   NumberOfBytesToRead = 0;
-
-       if( PtrVCB->FreeBlocksCount == 0 )
-       {
-               //
-               //      No Free Block left...
-               //      Fail request...
-               //
-               return 0;
-       }
-
-       try
-       {
-               BOOLEAN Found = FALSE;
-               ULONG Block;
-               ULONG GroupNo;
-               LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-
-               for( GroupNo = 0; PtrVCB->NoOfGroups; GroupNo++ )
-               {
-                       if( PtrVCB->PtrGroupDescriptors[ GroupNo ].FreeBlocksCount )
-                               break;
-               }
-
-               VolumeByteOffset.QuadPart = 
-                       PtrVCB->PtrGroupDescriptors[ GroupNo ].BlockBitmapBlock * LogicalBlockSize;
-               
-               NumberOfBytesToRead = PtrVCB->BlocksCount / PtrVCB->NoOfGroups;
-
-               if( NumberOfBytesToRead % 8 )
-               {
-                       NumberOfBytesToRead = ( NumberOfBytesToRead / 8 ) + 1;
-               }
-               else
-               {
-                       NumberOfBytesToRead = ( NumberOfBytesToRead / 8 ) ;
-               }
-               
-               
-               for( Block = 0; !Found && Block < Ext2Align( NumberOfBytesToRead , LogicalBlockSize ); 
-                               Block += LogicalBlockSize, VolumeByteOffset.QuadPart += LogicalBlockSize)                       
-               {
-                       //
-                       //      Read in the block bitmap block...
-                       ULONG i, j;
-                       BYTE Bitmap;
-                                       
-                       if( !CcPinRead( PtrVCB->PtrStreamFileObject,
-                                  &VolumeByteOffset,
-                                  LogicalBlockSize,                                    //      NumberOfBytesToRead,
-                                  TRUE,
-                                  &PtrBitmapBCB,
-                                  (PVOID*)&PtrBitmapBuffer ) )
-                       {
-                               DebugTrace(DEBUG_TRACE_ERROR, "Cache read failiure while reading in volume meta data", 0);
-                               try_return( BlockNo = 0 );
-                       }
-
-                       //
-                       //      Is there a free block...
-                       //      
-                       for( i = 0; !Found && i < LogicalBlockSize && 
-                                       i + (Block * LogicalBlockSize) < NumberOfBytesToRead; i++ )
-                       {
-                               Bitmap = PtrBitmapBuffer[i];
-                               if( Bitmap != 0xff )
-                               {
-                                       //
-                                       //      Found a free block...
-                                       for( j = 0; !Found && j < 8; j++ )
-                                       {
-                                               if( ( Bitmap & 0x01 ) == 0 )
-                                               {
-                                                       //
-                                                       //      Found...
-                                                       Found = TRUE;
-                                                       BlockNo = ( ( ( Block * LogicalBlockSize) + i ) * 8) + j + 1
-                                                               + ( GroupNo * PtrVCB->BlocksPerGroup );
-
-                                                       Bitmap = 1 << j;
-                                                       PtrBitmapBuffer[i] |= Bitmap;
-                                                       
-                                                       CcSetDirtyPinnedData( PtrBitmapBCB, NULL );
-                                                       Ext2SaveBCB( PtrIrpContext, PtrBitmapBCB, PtrVCB->PtrStreamFileObject );
-                                                       //
-                                                       //      Should update the bitmaps in the other groups too...
-                                                       //
-                                                       break;
-                                               }
-                                               Bitmap = Bitmap >> 1;
-                                       }
-                               }
-                       }
-                       //
-                       //      Unpin the BCB...
-                       //
-                       if( PtrBitmapBCB )
-                       {
-                               CcUnpinData( PtrBitmapBCB );
-                               PtrBitmapBCB = NULL;
-                       }
-
-               }
-
-               //
-               //      Updating the Free Block count in the Group Descriptor...
-               //      
-               
-               {
-                       PBCB                                    PtrDescriptorBCB = NULL;
-                       PEXT2_GROUP_DESCRIPTOR  PtrGroupDescriptor = NULL;
-                       //
-                       //      Updating the Free Blocks count in the Group Descriptor...
-                       //      
-                       PtrVCB->PtrGroupDescriptors[ GroupNo ].FreeBlocksCount--;
-
-                       if( PtrVCB->LogBlockSize )
-                       {
-                               //      First block contains the descriptors...
-                               VolumeByteOffset.QuadPart = LogicalBlockSize;
-                       }
-                       else
-                       {
-                               //      Second block contains the descriptors...
-                               VolumeByteOffset.QuadPart = LogicalBlockSize * 2;
-                       }
-                       NumberOfBytesToRead = PtrVCB->NoOfGroups * sizeof( struct ext2_group_desc );
-                       NumberOfBytesToRead = Ext2Align( NumberOfBytesToRead, LogicalBlockSize );
-
-                       if (!CcPinRead( PtrVCB->PtrStreamFileObject,
-                                  &VolumeByteOffset,
-                                  NumberOfBytesToRead,
-                                  TRUE,
-                                  &PtrDescriptorBCB ,
-                                  (PVOID*)&PtrGroupDescriptor )) 
-                       {
-                               DebugTrace(DEBUG_TRACE_ERROR,   "Cache read failiure while reading in volume meta data", 0);
-                               //
-                               //      Ignore this error...
-                               //      Not fatal...
-                       }
-                       else
-                       {
-                               PtrGroupDescriptor[ GroupNo ].bg_free_blocks_count= 
-                                       PtrVCB->PtrGroupDescriptors[ GroupNo ].FreeBlocksCount; 
-
-                               //
-                               //      Not synchronously flushing this information...
-                               //      Lazy writing will do...
-                               //
-                               CcSetDirtyPinnedData( PtrDescriptorBCB, NULL );
-                               CcUnpinData( PtrDescriptorBCB );
-                               PtrDescriptorBCB = NULL;
-                       }
-               }
-               
-               //
-               //      Update the Block count
-               //      in the super block and in the VCB
-               //
-               {
-                       //      Ext2 Super Block information...
-                       PEXT2_SUPER_BLOCK       PtrSuperBlock = NULL;
-                       PBCB                            PtrSuperBlockBCB = NULL;
-
-                       PtrVCB->FreeBlocksCount--;
-
-                       //      Reading in the super block...
-                       VolumeByteOffset.QuadPart = 1024;
-                       NumberOfBytesToRead = Ext2Align( sizeof( EXT2_SUPER_BLOCK ), LogicalBlockSize );
-
-                       if( !CcPinRead( PtrVCB->PtrStreamFileObject,
-                                  &VolumeByteOffset,
-                                  NumberOfBytesToRead,
-                                  TRUE,
-                                  &PtrSuperBlockBCB,
-                                  (PVOID*)&PtrSuperBlock ) )
-                       {
-                               DebugTrace(DEBUG_TRACE_ERROR,   "Cache read failiure while reading in volume meta data", 0);
-                       }
-                       else
-                       {
-                               PtrSuperBlock->s_free_blocks_count = PtrVCB->FreeBlocksCount;
-                               CcSetDirtyPinnedData( PtrSuperBlockBCB, NULL );
-                               Ext2SaveBCB( PtrIrpContext, PtrSuperBlockBCB, PtrVCB->PtrStreamFileObject );
-                               if( PtrSuperBlockBCB )
-                               {
-                                       CcUnpinData( PtrSuperBlockBCB );
-                                       PtrSuperBlockBCB = NULL;
-                               }
-                       }
-               }
-
-               try_exit:       NOTHING;
-       }
-       finally
-       {
-               if( PtrBitmapBCB )
-               {
-                       CcUnpinData( PtrBitmapBCB );
-                       PtrBitmapBCB = NULL;
-               }
-               DebugTrace( DEBUG_TRACE_SPECIAL, " Allocating a block - Block no : %ld", BlockNo );
-       }
-       return BlockNo;
-}
-
-/*************************************************************************
-*
-* Function: Ext2DeallocBlock()
-*
-* Description:
-*      The functions will deallocate a data block 
-*
-* Expected Interrupt Level (for execution) :
-*  IRQL_PASSIVE_LEVEL 
-*
-* Return Value: Success / Failure...
-*
-*************************************************************************/
-BOOLEAN NTAPI Ext2DeallocBlock( 
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2VCB                      PtrVCB,
-       ULONG                           BlockNo )
-{
-       //      Buffer Control Block
-       PBCB                    PtrBitmapBCB = NULL;
-       BYTE *                  PtrBitmapBuffer = NULL;
-       BOOLEAN                 RC = TRUE;
-       LARGE_INTEGER   VolumeByteOffset;
-       ULONG                   LogicalBlockSize = 0;
-       //      ULONG                   NumberOfBytesToRead = 0;
-
-       DebugTrace( DEBUG_TRACE_SPECIAL, " Deallocating a block - Block no : %ld", BlockNo );
-       
-       try
-       {
-               ULONG   GroupNo;
-               ULONG   BlockIndex;
-               ULONG   BitmapIndex;
-               BYTE    Bitmap;
-
-               LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-
-               GroupNo = BlockNo / PtrVCB->BlocksPerGroup;
-               BlockNo = BlockNo % PtrVCB->BlocksPerGroup;
-
-               Bitmap = 1 << ( (BlockNo-1) % 8 );
-               BitmapIndex =  (BlockNo-1) / 8;
-               BlockIndex = BitmapIndex / LogicalBlockSize;
-               //      Adjusting to index into the Logical block that contains the bitmap
-               BitmapIndex = BitmapIndex - ( BlockIndex * LogicalBlockSize );
-
-               VolumeByteOffset.QuadPart = 
-                       ( PtrVCB->PtrGroupDescriptors[ GroupNo ].BlockBitmapBlock + BlockIndex ) 
-                       * LogicalBlockSize;
-               
-               //
-               //      Read in the bitmap block...
-               //
-               if( !CcPinRead( PtrVCB->PtrStreamFileObject,
-                               &VolumeByteOffset,
-                               LogicalBlockSize,
-                               TRUE,                   //      Can Wait...
-                               &PtrBitmapBCB,
-                               (PVOID*)&PtrBitmapBuffer ) )
-               {
-                       //      Unable to Pin the data into the cache...
-                       try_return (RC = FALSE);
-               }
-
-               //
-               //      Locate the block 'bit'...
-               //      This block 'bit' is in the byte PtrBitmapBuffer[ BitmapIndex ]
-               if( ( PtrBitmapBuffer[ BitmapIndex ] & Bitmap ) == 0)
-               {
-                       //      This shouldn't have been so...
-                       //      The block was never allocated!
-                       //      How to deallocate something that hasn't been allocated? 
-                       //      Hmmm... ;)
-                       //      Ignore this error...
-                       try_return (RC = TRUE);
-               }
-
-               //      Setting the bit for the inode...
-               PtrBitmapBuffer[ BitmapIndex ] &= (~Bitmap);
-
-               //      Update the cache...
-               CcSetDirtyPinnedData( PtrBitmapBCB, NULL );
-
-               //      Save up the BCB for forcing a synchronous write...
-               //      Before completing the IRP...
-               Ext2SaveBCB( PtrIrpContext, PtrBitmapBCB, PtrVCB->PtrStreamFileObject );
-
-
-               if( PtrBitmapBCB )
-               {
-                       CcUnpinData( PtrBitmapBCB );
-                       PtrBitmapBCB = NULL;
-               }
-               
-               //
-               //      Updating the Block count in the Group Descriptor...
-               //      
-               
-               {
-                       PBCB                                    PtrDescriptorBCB = NULL;
-                       PEXT2_GROUP_DESCRIPTOR  PtrGroupDescriptor = NULL;
-                       ULONG                                   NumberOfBytesToRead = 0;
-                       //
-                       //      Updating the Free Blocks count in the Group Descriptor...
-                       //      
-                       PtrVCB->PtrGroupDescriptors[ GroupNo ].FreeBlocksCount++;
-
-                       if( PtrVCB->LogBlockSize )
-                       {
-                               //      First block contains the descriptors...
-                               VolumeByteOffset.QuadPart = LogicalBlockSize;
-                       }
-                       else
-                       {
-                               //      Second block contains the descriptors...
-                               VolumeByteOffset.QuadPart = LogicalBlockSize * 2;
-                       }
-                       NumberOfBytesToRead = PtrVCB->NoOfGroups * sizeof( struct ext2_group_desc );
-                       NumberOfBytesToRead = Ext2Align( NumberOfBytesToRead, LogicalBlockSize );
-
-                       if (!CcPinRead( PtrVCB->PtrStreamFileObject,
-                                  &VolumeByteOffset,
-                                  NumberOfBytesToRead,
-                                  TRUE,
-                                  &PtrDescriptorBCB ,
-                                  (PVOID*)&PtrGroupDescriptor )) 
-                       {
-                               DebugTrace(DEBUG_TRACE_ERROR,   "Cache read failiure while reading in volume meta data", 0);
-                               //
-                               //      Ignore this error...
-                               //      Not fatal...
-                       }
-                       else
-                       {
-                               PtrGroupDescriptor[ GroupNo ].bg_free_blocks_count= 
-                                       PtrVCB->PtrGroupDescriptors[ GroupNo ].FreeBlocksCount; 
-
-                               //
-                               //      Not synchronously flushing this information...
-                               //      Lazy writing will do...
-                               //
-                               CcSetDirtyPinnedData( PtrDescriptorBCB, NULL );
-                               CcUnpinData( PtrDescriptorBCB );
-                               PtrDescriptorBCB = NULL;
-                       }
-               }
-
-               //
-               //      Update the Block count
-               //      in the super block and in the VCB
-               //
-               {
-                       //      Ext2 Super Block information...
-                       PEXT2_SUPER_BLOCK       PtrSuperBlock = NULL;
-                       PBCB                            PtrSuperBlockBCB = NULL;
-                       ULONG                           NumberOfBytesToRead = 0;
-
-                       PtrVCB->FreeBlocksCount++;
-
-                       //      Reading in the super block...
-                       VolumeByteOffset.QuadPart = 1024;
-                       NumberOfBytesToRead = Ext2Align( sizeof( EXT2_SUPER_BLOCK ), LogicalBlockSize );
-
-                       if( !CcPinRead( PtrVCB->PtrStreamFileObject,
-                                  &VolumeByteOffset,
-                                  NumberOfBytesToRead,
-                                  TRUE,
-                                  &PtrSuperBlockBCB,
-                                  (PVOID*)&PtrSuperBlock ) )
-                       {
-                               DebugTrace(DEBUG_TRACE_ERROR,   "Cache read failiure while reading in volume meta data", 0);
-                       }
-                       else
-                       {
-                               PtrSuperBlock->s_free_blocks_count = PtrVCB->FreeBlocksCount;
-                               CcSetDirtyPinnedData( PtrSuperBlockBCB, NULL );
-                               Ext2SaveBCB( PtrIrpContext, PtrSuperBlockBCB, PtrVCB->PtrStreamFileObject );
-                               CcUnpinData( PtrSuperBlockBCB );
-                               PtrSuperBlockBCB = NULL;
-                       }
-               }
-               try_exit:       NOTHING;
-       }
-       finally
-       {
-               if( PtrBitmapBCB )
-               {
-                       CcUnpinData( PtrBitmapBCB );
-                       PtrBitmapBCB = NULL;
-               }
-       }
-       return RC;
-}
-
-BOOLEAN NTAPI Ext2UpdateFileSize(      
-       PtrExt2IrpContext       PtrIrpContext,
-       PFILE_OBJECT            PtrFileObject,
-       PtrExt2FCB                      PtrFCB)
-{
-       EXT2_INODE                      Inode;
-       PtrExt2VCB                      PtrVCB = PtrFCB->PtrVCB;
-
-       if( PtrFileObject->PrivateCacheMap )
-       {
-               CcSetFileSizes( PtrFileObject, (PCC_FILE_SIZES)&(PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize));
-       }
-       //      Now update the size on the disk...
-       //      Read in the inode...
-       if( ! NT_SUCCESS( Ext2ReadInode( PtrVCB, PtrFCB->INodeNo, &Inode ) ) )
-       {
-               return FALSE;
-       }
-
-       Inode.i_size = PtrFCB->NTRequiredFCB.CommonFCBHeader.FileSize.LowPart;
-       //      Update time also???
-
-       //      Updating the inode...
-       if( NT_SUCCESS( Ext2WriteInode( PtrIrpContext, PtrVCB, PtrFCB->INodeNo, &Inode ) ) )
-       {
-               return TRUE;
-       }
-       else
-       {
-               return FALSE;
-       }
-}
-
-/*************************************************************************
-*
-* Function: Ext2DeleteFile()
-*
-* Description:
-*      The functions will delete a file
-*
-* Expected Interrupt Level (for execution) :
-*  IRQL_PASSIVE_LEVEL 
-*
-* Return Value: Success / Failure...
-*
-*************************************************************************/
-BOOLEAN NTAPI Ext2DeleteFile(
-       PtrExt2FCB                      PtrFCB,
-       PtrExt2IrpContext       PtrIrpContext)
-{
-       EXT2_INODE                      Inode;
-       PtrExt2FCB                      PtrParentFCB = NULL;
-       PtrExt2VCB                      PtrVCB = PtrFCB->PtrVCB;
-       
-       //
-       //      Get the Parent Directory...
-       PtrParentFCB = Ext2LocateFCBInCore( PtrVCB, PtrFCB->ParentINodeNo );
-       Ext2InitializeFCBInodeInfo( PtrFCB );
-       
-       //      1.
-       //      Free up the directory entry...
-       if( !Ext2FreeDirectoryEntry( PtrIrpContext,
-                       PtrParentFCB, &PtrFCB->FCBName->ObjectName ) )
-       {
-               return FALSE;
-       }
-
-       //      2. 
-       //      Decrement Link count...
-       if( !NT_SUCCESS( Ext2ReadInode( PtrVCB, PtrFCB->INodeNo, &Inode ) ) )
-       {
-               return FALSE;
-       }
-
-       ASSERT( Inode.i_links_count == PtrFCB->LinkCount );
-       
-       Inode.i_links_count--;
-       PtrFCB->LinkCount = Inode.i_links_count; 
-
-       if( !Inode.i_links_count )
-       {
-               //
-               //      Setting the deletion time field in the inode...
-               //
-               ULONG Time;
-               Time = Ext2GetCurrentTime();
-               Inode.i_dtime = Time ;
-       }
-
-       //      3. 
-       //      Updating the inode...
-
-       if( NT_SUCCESS( Ext2WriteInode( PtrIrpContext, PtrVCB, PtrFCB->INodeNo, &Inode ) ) )
-       {
-               if( Inode.i_links_count )
-               {
-                       //      Some more links to the same file are available...
-                       //      So we won't deallocate the data blocks...
-                       return TRUE;
-               }
-       }
-       else
-       {
-               return FALSE;
-       }
-
-       //      4.
-       //      Free up the inode...
-       Ext2DeallocInode( PtrIrpContext, PtrVCB, PtrFCB->INodeNo );
-
-       //      5.
-       //      Release the data blocks...
-       Ext2ReleaseDataBlocks( PtrFCB, PtrIrpContext);
-
-       return TRUE;
-}
-
-
-/*************************************************************************
-*
-* Function: Ext2ReleaseDataBlocks()
-*
-* Description:
-*      The functions will release all the data blocks in a file
-*      It does NOT update the file inode... 
-*
-* Expected Interrupt Level (for execution) :
-*  IRQL_PASSIVE_LEVEL 
-*
-* Return Value: Success / Failure...
-*
-*************************************************************************/
-BOOLEAN NTAPI Ext2ReleaseDataBlocks(
-       PtrExt2FCB                      PtrFCB,
-       PtrExt2IrpContext       PtrIrpContext)
-{
-       PtrExt2VCB                      PtrVCB = PtrFCB->PtrVCB;
-       ULONG LogicalBlockSize;
-       ULONG i;
-
-
-       LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-
-       //      Release the data blocks...
-
-       //      1.
-       //      Free up the triple indirect blocks...
-       if( PtrFCB->IBlock[ EXT2_TIND_BLOCK ] )
-       {
-               
-               PBCB                    PtrSIBCB = NULL;
-               PBCB                    PtrDIBCB = NULL;
-               PBCB                    PtrTIBCB = NULL;
-
-               ULONG *                 PtrPinnedSIndirectBlock = NULL;
-               ULONG *                 PtrPinnedDIndirectBlock = NULL;
-               ULONG *                 PtrPinnedTIndirectBlock = NULL;
-               
-               LARGE_INTEGER   VolumeByteOffset;
-               ULONG                   TIndex, DIndex, SIndex;
-
-               //      Pin the Double Indirect Pointer Block...
-               VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_TIND_BLOCK ] * LogicalBlockSize;
-               if (!CcMapData( PtrVCB->PtrStreamFileObject,
-                  &VolumeByteOffset,
-                  LogicalBlockSize,
-                  TRUE,
-                  &PtrTIBCB,
-                  (PVOID*)&PtrPinnedTIndirectBlock )) 
-               {
-                       return FALSE;
-               }
-
-               //      Read the Block numbers off the Triple Indirect Pointer Block...
-               for( TIndex = 0; TIndex < (LogicalBlockSize/sizeof(ULONG)); TIndex++ )
-               {
-                       if( PtrPinnedTIndirectBlock[ TIndex ] )
-                       {
-                               VolumeByteOffset.QuadPart = PtrPinnedTIndirectBlock[TIndex] * LogicalBlockSize;
-                               if (!CcMapData( PtrVCB->PtrStreamFileObject,
-                                  &VolumeByteOffset,
-                                  LogicalBlockSize,
-                                  TRUE,
-                                  &PtrDIBCB,
-                                  (PVOID*)&PtrPinnedDIndirectBlock )) 
-                               {
-                                       return FALSE;
-                               }
-
-                               //      Read the Block numbers off the Double Indirect Pointer Blocks...
-                               for( DIndex = 0; DIndex < (LogicalBlockSize/sizeof(ULONG)); DIndex++ )
-                               {
-                                       if( PtrPinnedDIndirectBlock[DIndex] )
-                                       {
-                                               VolumeByteOffset.QuadPart = PtrPinnedDIndirectBlock[DIndex] * LogicalBlockSize;
-                                               if (!CcMapData( PtrVCB->PtrStreamFileObject,
-                                                  &VolumeByteOffset,
-                                                  LogicalBlockSize,
-                                                  TRUE,
-                                                  &PtrSIBCB,
-                                                  (PVOID*)&PtrPinnedSIndirectBlock )) 
-                                               {
-                                                       return FALSE;
-                                               }
-
-                                               //      Read the Block numbers off the Single Indirect Pointer Blocks and 
-                                               //      free the data blocks
-                                               for( SIndex = 0; SIndex < (LogicalBlockSize/sizeof(ULONG)); SIndex++ )
-                                               {
-                                                       if( PtrPinnedSIndirectBlock[ SIndex ] )
-                                                       {
-                                                               Ext2DeallocBlock( PtrIrpContext, PtrVCB, PtrPinnedSIndirectBlock[SIndex] );
-                                                       }
-                                                       else
-                                                       {
-                                                               break;
-                                                       }
-                                               }
-                                               CcUnpinData( PtrSIBCB );
-                                               
-                                               //      Deallocating
-                                               //      Single Indirect Pointer Block
-                                               Ext2DeallocBlock( PtrIrpContext, PtrVCB, PtrPinnedDIndirectBlock[DIndex] );
-                                       }
-                                       else
-                                       {
-                                               break;
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               break;
-                       }
-               }
-               CcUnpinData( PtrTIBCB );
-               //      Deallocating Triple Indirect Pointer Blocks
-               Ext2DeallocBlock( PtrIrpContext, PtrVCB, PtrFCB->IBlock[ EXT2_TIND_BLOCK ] );
-       }
-
-       //      2.
-       //      Free up the double indirect blocks...
-       if( PtrFCB->IBlock[ EXT2_DIND_BLOCK ] )
-       {
-               PBCB                    PtrDIBCB = NULL;
-               PBCB                    PtrSIBCB = NULL;
-               ULONG *                 PtrPinnedSIndirectBlock = NULL;
-               ULONG *                 PtrPinnedDIndirectBlock = NULL;
-               
-               LARGE_INTEGER   VolumeByteOffset;
-               ULONG                   DIndex, SIndex;
-
-               //      Pin the Double Indirect Pointer Block...
-               VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
-               if (!CcMapData( PtrVCB->PtrStreamFileObject,
-                  &VolumeByteOffset,
-                  LogicalBlockSize,
-                  TRUE,
-                  &PtrDIBCB,
-                  (PVOID*)&PtrPinnedDIndirectBlock )) 
-               {
-                       return FALSE;
-               }
-
-               //      Read the Block numbers off the Double Indirect Pointer Block...
-               for( DIndex = 0; DIndex < (LogicalBlockSize/sizeof(ULONG)); DIndex++ )
-               {
-                       if( PtrPinnedDIndirectBlock[DIndex] )
-                       {
-                               VolumeByteOffset.QuadPart = PtrPinnedDIndirectBlock[DIndex] * LogicalBlockSize;
-                               if (!CcMapData( PtrVCB->PtrStreamFileObject,
-                                  &VolumeByteOffset,
-                                  LogicalBlockSize,
-                                  TRUE,
-                                  &PtrSIBCB,
-                                  (PVOID*)&PtrPinnedSIndirectBlock )) 
-                               {
-                                       return FALSE;
-                               }
-
-                               //      Read the Block numbers off the Single Indirect Pointer Blocks and 
-                               //      free the data blocks
-                               for( SIndex = 0; SIndex < (LogicalBlockSize/sizeof(ULONG)); SIndex++ )
-                               {
-                                       if( PtrPinnedSIndirectBlock[ SIndex ] )
-                                       {
-                                               Ext2DeallocBlock( PtrIrpContext, PtrVCB, PtrPinnedSIndirectBlock[SIndex] );
-                                       }
-                                       else
-                                       {
-                                               break;
-                                       }
-                               }
-                               CcUnpinData( PtrSIBCB );
-                               
-                               //      Deallocating
-                               //      Single Indirect Pointer Block
-                               Ext2DeallocBlock( PtrIrpContext, PtrVCB, PtrPinnedDIndirectBlock[DIndex] );
-                       }
-                       else
-                       {
-                               break;
-                       }
-               }
-               CcUnpinData( PtrDIBCB );
-               //      Deallocating Double Indirect Pointer Blocks
-               Ext2DeallocBlock( PtrIrpContext, PtrVCB, PtrFCB->IBlock[ EXT2_DIND_BLOCK ] );
-       }
-
-       //      3.
-       //      Free up the single indirect blocks...
-       if( PtrFCB->IBlock[ EXT2_IND_BLOCK ] )
-       {
-               PBCB                    PtrBCB = NULL;
-               ULONG *                 PtrPinnedSIndirectBlock = NULL;
-               LARGE_INTEGER   VolumeByteOffset;
-               ULONG                   Index;
-
-               //      Pin the Single Indirect Pointer Block...
-               VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
-               if (!CcMapData( PtrVCB->PtrStreamFileObject,
-                  &VolumeByteOffset,
-                  LogicalBlockSize,
-                  TRUE,
-                  &PtrBCB,
-                  (PVOID*)&PtrPinnedSIndirectBlock )) 
-               {
-                       return FALSE;
-               }
-
-               //      Read the Block numbers off the Indirect Pointer Block and 
-               //      free the data blocks
-               for( Index = 0; Index < (LogicalBlockSize/sizeof(ULONG)); Index++ )
-               {
-                       if( PtrPinnedSIndirectBlock[Index] )
-                       {
-                               Ext2DeallocBlock( PtrIrpContext, PtrVCB, PtrPinnedSIndirectBlock[Index] );
-                       }
-                       else
-                       {
-                               break;
-                       }
-               }
-               CcUnpinData( PtrBCB );
-               Ext2DeallocBlock( PtrIrpContext, PtrVCB, PtrFCB->IBlock[ EXT2_IND_BLOCK ] );
-       }
-
-       //      4.
-       //      Free up the direct blocks...
-       for( i = 0; i < EXT2_NDIR_BLOCKS; i++ )
-       {
-               if( PtrFCB->IBlock[ i ] )
-               {
-                       Ext2DeallocBlock( PtrIrpContext, PtrVCB, PtrFCB->IBlock[ i ] );
-               }
-               else
-               {
-                       break;
-               }
-       }
-       return TRUE;
-}
-
-
-BOOLEAN NTAPI Ext2TruncateFileAllocationSize(
-       PtrExt2IrpContext       PtrIrpContext,
-       PtrExt2FCB                      PtrFCB,
-       PFILE_OBJECT            PtrFileObject,
-       PLARGE_INTEGER          PtrAllocationSize )
-{
-       PtrExt2VCB                      PtrVCB = PtrFCB->PtrVCB;
-       ULONG LogicalBlockSize;
-       ULONG i;
-
-       ULONG NoOfBlocksToBeLeft= 0;
-       ULONG CurrentBlockNo = 0;
-
-       //
-       //      This function has not been tested...
-       //
-       Ext2BreakPoint();
-
-       LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
-       NoOfBlocksToBeLeft = (ULONG) (PtrAllocationSize->QuadPart / LogicalBlockSize);
-
-       
-
-       //      Release the data blocks...
-
-       //      1.
-       //      Free up the direct blocks...
-       for( i = NoOfBlocksToBeLeft; i < EXT2_NDIR_BLOCKS; i++ )
-       {
-               if( PtrFCB->IBlock[ i ] )
-               {
-                       Ext2DeallocBlock( PtrIrpContext, PtrVCB, PtrFCB->IBlock[ i ] );
-                       PtrFCB->IBlock[ i ] = 0;
-               }
-               else
-               {
-                       break;
-               }
-       }
-
-       //      2.
-       //      Free up the single indirect blocks...
-       CurrentBlockNo = EXT2_NDIR_BLOCKS;
-
-       if( PtrFCB->IBlock[ EXT2_IND_BLOCK ] )
-       {
-               PBCB                    PtrBCB = NULL;
-               ULONG *                 PtrPinnedSIndirectBlock = NULL;
-               LARGE_INTEGER   VolumeByteOffset;
-               ULONG                   Index;
-
-               //      Pin the Single Indirect Pointer Block...
-               VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
-               if (!CcMapData( PtrVCB->PtrStreamFileObject,
-                  &VolumeByteOffset,
-                  LogicalBlockSize,
-                  TRUE,
-                  &PtrBCB,
-                  (PVOID*)&PtrPinnedSIndirectBlock )) 
-               {
-                       return FALSE;
-               }
-
-               //      Read the Block numbers off the Indirect Pointer Block and 
-               //      free the data blocks
-               for( Index = 0; Index < (LogicalBlockSize/sizeof(ULONG)); 
-                        Index++, CurrentBlockNo++ )
-               {
-                       if( CurrentBlockNo >= NoOfBlocksToBeLeft )
-                       {
-                               if( PtrPinnedSIndirectBlock[Index] )
-                               {
-                                       Ext2DeallocBlock( PtrIrpContext, PtrVCB, PtrPinnedSIndirectBlock[Index] );
-                               }
-                               else
-                               {
-                                       break;
-                               }
-                       }
-                       else if( !PtrPinnedSIndirectBlock[Index] )
-                       {
-                               break;
-                       }
-               }
-               if( NoOfBlocksToBeLeft <= EXT2_NDIR_BLOCKS )
-               {
-                       Ext2DeallocBlock( PtrIrpContext, PtrVCB, PtrFCB->IBlock[ EXT2_IND_BLOCK ] );
-                       PtrFCB->IBlock[ EXT2_IND_BLOCK ] = 0;
-               }
-
-               CcUnpinData( PtrBCB );
-       }
-       
-       //      3.
-       //      Free up the double indirect blocks...
-       if( PtrFCB->IBlock[ EXT2_DIND_BLOCK ] )
-       {
-               
-       }
-
-       //      4.
-       //      Free up the triple indirect blocks...
-       if( PtrFCB->IBlock[ EXT2_TIND_BLOCK ] )
-       {
-               
-       }
-
-       return TRUE;
-}
-
-BOOLEAN NTAPI Ext2IsDirectoryEmpty(
-       PtrExt2FCB                      PtrFCB,
-       PtrExt2CCB                      PtrCCB,
-       PtrExt2IrpContext       PtrIrpContext)
-{
-
-       PFILE_OBJECT            PtrFileObject = NULL;
-
-       if( !Ext2IsFlagOn(PtrFCB->FCBFlags, EXT2_FCB_DIRECTORY) )
-       {
-               return FALSE;
-       }
-
-       //      1. 
-       //      Initialize the Blocks in the FCB...
-       //
-       Ext2InitializeFCBInodeInfo( PtrFCB );
-
-       
-       //      2.
-       //      Get hold of the file object...
-       //
-       PtrFileObject = PtrCCB->PtrFileObject;
-
-
-       //      3.
-       //      Now initiating Caching, pinned access to be precise ...
-       //
-       if (PtrFileObject->PrivateCacheMap == NULL) 
-       {
-               CcInitializeCacheMap(PtrFileObject, (PCC_FILE_SIZES)(&(PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize)),
-                       TRUE,           // We utilize pin access for directories
-                       &(Ext2GlobalData.CacheMgrCallBacks), // callbacks
-                       PtrFCB );               // The context used in callbacks
-       }
-
-       //      4.
-       //      Getting down to the real business now... ;)
-       //      Read in the directory contents and do a search 
-       //
-       {
-               LARGE_INTEGER   StartBufferOffset;
-               ULONG                   PinBufferLength;
-               ULONG                   BufferIndex;
-               PBCB                    PtrBCB = NULL;
-               BYTE *                  PtrPinnedBlockBuffer = NULL;
-               PEXT2_DIR_ENTRY PtrDirEntry = NULL;
-               BOOLEAN                 Found = FALSE;
-
-               StartBufferOffset.QuadPart = 0;
-
-               //
-               //      Read in the whole directory
-               //      **Bad programming**
-               //      Will do for now.
-               //
-               PinBufferLength = PtrFCB->NTRequiredFCB.CommonFCBHeader.FileSize.LowPart;
-               if (!CcMapData( PtrFileObject,
-                  &StartBufferOffset,
-                  PinBufferLength,
-                  TRUE,
-                  &PtrBCB,
-                  (PVOID*)&PtrPinnedBlockBuffer ) )
-               {
-                       return FALSE;
-               }
-               
-               //
-               //      Walking through now...
-               //
-               for( BufferIndex = 0, Found = FALSE; !Found && BufferIndex < ( PtrFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart - 1) ; BufferIndex += PtrDirEntry->rec_len )
-               {
-                       PtrDirEntry = (PEXT2_DIR_ENTRY) &PtrPinnedBlockBuffer[ BufferIndex ];
-                       if( PtrDirEntry->inode == 0)
-                       {
-                               //      Deleted entry...
-                               //  Ignore...
-                               continue;
-                       }
-                       if( PtrDirEntry->name[0] == '.' )
-                       {
-                               if( PtrDirEntry->name_len == 1 || 
-                                 ( PtrDirEntry->name_len == 2 && PtrDirEntry->name[1] == '.' ) )
-                               {
-                                 continue;
-                               }
-                       }
-                       Found = TRUE;
-               }
-               CcUnpinData( PtrBCB );
-               PtrBCB = NULL;
-
-               return !Found;
-       }
-}
-
-
-NTSTATUS NTAPI Ext2RenameOrLinkFile( 
-       PtrExt2FCB                                      PtrSourceFCB, 
-       PFILE_OBJECT                            PtrSourceFileObject,    
-       PtrExt2IrpContext                       PtrIrpContext,
-       PIRP                                            PtrIrp, 
-       PFILE_RENAME_INFORMATION        PtrRenameInfo)
-{
-       PtrExt2FCB                              PtrParentFCB = NULL;
-       PtrExt2VCB                              PtrSourceVCB = PtrSourceFCB->PtrVCB;
-
-       PtrExt2FCB                              PtrTargetFCB = NULL;
-       PtrExt2CCB                              PtrTargetCCB = NULL;
-       PtrExt2VCB                              PtrTargetVCB = NULL;
-
-
-       FILE_INFORMATION_CLASS  FunctionalityRequested;
-       PIO_STACK_LOCATION              PtrIoStackLocation = NULL;
-       PFILE_OBJECT                    TargetFileObject = NULL;
-       BOOLEAN                                 ReplaceExistingFile = FALSE;
-       BOOLEAN                                 Found = FALSE;
-
-       PtrIoStackLocation = IoGetCurrentIrpStackLocation(PtrIrp);
-       FunctionalityRequested = PtrIoStackLocation->Parameters.SetFile.FileInformationClass;
-       TargetFileObject = PtrIoStackLocation->Parameters.SetFile.FileObject;
-       ReplaceExistingFile = PtrIoStackLocation->Parameters.SetFile.ReplaceIfExists;
-
-       // Get the FCB and CCB pointers
-       Ext2GetFCB_CCB_VCB_FromFileObject ( 
-               TargetFileObject , &PtrTargetFCB, &PtrTargetCCB, &PtrTargetVCB);
-
-       if( !PtrTargetCCB )
-       {
-               return STATUS_ACCESS_DENIED;
-       }
-       if( PtrTargetVCB != PtrSourceVCB )
-       {
-               //      Cannot rename across volumes...
-               return STATUS_ACCESS_DENIED;
-       }
-       if ( !Ext2IsFlagOn( PtrTargetFCB->FCBFlags, EXT2_FCB_DIRECTORY ) )
-       {
-               //      Target has to be a folder...
-               return STATUS_ACCESS_DENIED;
-       }
-
-       //      1.
-       //      Open the parent folder...
-       PtrParentFCB = Ext2LocateFCBInCore( PtrSourceVCB, PtrSourceFCB->ParentINodeNo );
-       if( !PtrParentFCB )
-       {
-               //      Get the folder from the disk
-               //      Use the inode no PtrSourceFCB->ParentINodeNo
-               //
-               //      For now...
-               return STATUS_ACCESS_DENIED;
-       }
-
-       //      2.
-       //      Check if the file exists in the TargetFolder...
-       {
-               LARGE_INTEGER   StartBufferOffset;
-               ULONG                   PinBufferLength;
-               ULONG                   BufferIndex;
-               PBCB                    PtrBCB = NULL;
-               BYTE *                  PtrPinnedBlockBuffer = NULL;
-               PEXT2_DIR_ENTRY PtrDirEntry = NULL;
-               int                             i;
-
-               StartBufferOffset.QuadPart = 0;
-
-               //
-               //      Read in the whole directory
-               //
-               if ( TargetFileObject->PrivateCacheMap == NULL )
-               {
-                       CcInitializeCacheMap(
-                               TargetFileObject, 
-                               (PCC_FILE_SIZES)(&(PtrTargetFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize)),
-                               TRUE,                                                                   // We utilize pin access for directories
-                               &(Ext2GlobalData.CacheMgrCallBacks),    // callbacks
-                               PtrTargetCCB );                                                 // The context used in callbacks
-               }
-               
-               PinBufferLength = PtrTargetFCB->NTRequiredFCB.CommonFCBHeader.FileSize.LowPart;
-               if (!CcMapData( TargetFileObject,
-                  &StartBufferOffset,
-                  PinBufferLength,
-                  TRUE,
-                  &PtrBCB,
-                  (PVOID*)&PtrPinnedBlockBuffer ) )
-               {
-                       return FALSE;
-               }
-               
-               //
-               //      Walking through now...
-               //
-               for( BufferIndex = 0, Found = FALSE; !Found && BufferIndex < ( PtrTargetFCB->NTRequiredFCB.CommonFCBHeader.FileSize.QuadPart - 1) ; BufferIndex += PtrDirEntry->rec_len )
-               {
-                       PtrDirEntry = (PEXT2_DIR_ENTRY) &PtrPinnedBlockBuffer[ BufferIndex ];
-                       if( PtrDirEntry->inode == 0)
-                       {
-                               //      Deleted entry...
-                               //  Ignore...
-                               continue;
-                       }
-                       if( PtrDirEntry->name_len == (PtrTargetCCB->RenameLinkTargetFileName.Length/2) )
-                       {
-                               Found = TRUE;
-                               for( i =0; i < PtrDirEntry->name_len ; i++ )
-                               {
-                                       if( PtrDirEntry->name[i] != PtrTargetCCB->RenameLinkTargetFileName.Buffer[i] )
-                                       {
-                                               Found = FALSE;
-                                               break;
-                                       }
-                               }
-                       }
-               }
-               CcUnpinData( PtrBCB );
-               PtrBCB = NULL;
-       }
-
-       //      3.
-       //      If the file exists, delete it if requested..
-       if( Found )
-       {
-               if( !ReplaceExistingFile )
-               {
-                       return STATUS_OBJECT_NAME_COLLISION;
-               }
-               //      Delete the file...
-               //      Reject this for now...
-               return STATUS_ACCESS_DENIED;
-       }
-
-
-       {
-               ULONG   Type = EXT2_FT_REG_FILE;
-               if( Ext2IsFlagOn( PtrSourceFCB->FCBFlags, EXT2_FCB_DIRECTORY ) )
-               {
-                       Type = EXT2_FT_DIR;
-               }
-
-               ASSERT( TargetFileObject );
-
-               //      4.
-               //      Remove the old entry...
-               Ext2FreeDirectoryEntry( PtrIrpContext, PtrParentFCB,
-                               &PtrSourceFCB->FCBName->ObjectName);
-
-               //      5. 
-               //      Create a new entry...
-               Ext2MakeNewDirectoryEntry(
-                       PtrIrpContext,                          //      This IRP Context
-                       PtrTargetFCB,                           //      Parent Folder FCB
-                       TargetFileObject,                       //      Parent Folder Object
-                       &PtrTargetCCB->RenameLinkTargetFileName, //     New entry's name
-                       Type,                                           //      The type of the new entry
-                       PtrSourceFCB->INodeNo );        //      The inode no of the new entry...
-
-       }
-
-       //      6. 
-       //      Update the PtrSourceFCB...
-       {
-
-               PtrExt2ObjectName               PtrObjectName;
-               if( PtrSourceFCB->FCBName )
-               {
-                       Ext2ReleaseObjectName( PtrSourceFCB->FCBName );
-               }
-               PtrObjectName = Ext2AllocateObjectName();
-               Ext2CopyUnicodeString( &PtrObjectName->ObjectName, &PtrTargetCCB->RenameLinkTargetFileName ); 
-               PtrSourceFCB->FCBName = PtrObjectName;
-               PtrSourceFCB->ParentINodeNo = PtrTargetFCB->INodeNo;
-       }
-
-       if( PtrTargetCCB->RenameLinkTargetFileName.Length )
-       {
-               Ext2DeallocateUnicodeString( &PtrTargetCCB->RenameLinkTargetFileName );
-       }
-
-       return STATUS_SUCCESS;
-}
diff --git a/drivers/filesystems/npfs/dirctl.c b/drivers/filesystems/npfs/dirctl.c
deleted file mode 100644 (file)
index 708320f..0000000
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * COPYRIGHT:  See COPYING in the top level directory
- * PROJECT:    ReactOS kernel
- * FILE:       drivers/filesystems/npfs/dirctl.c
- * PURPOSE:    Named pipe filesystem
- * PROGRAMMER: Eric Kohl
- */
-
-/* INCLUDES ******************************************************************/
-
-#include "npfs.h"
-
-#define NDEBUG
-#include <debug.h>
-
-/* FUNCTIONS *****************************************************************/
-
-static NTSTATUS
-NpfsQueryDirectory(PNPFS_CCB Ccb,
-                   PIRP Irp,
-                   PULONG Size)
-{
-    PIO_STACK_LOCATION Stack;
-    ULONG BufferLength = 0;
-    PUNICODE_STRING SearchPattern = NULL;
-    FILE_INFORMATION_CLASS FileInformationClass;
-    ULONG FileIndex = 0;
-    PUCHAR Buffer = NULL;
-    BOOLEAN First = FALSE;
-    PLIST_ENTRY CurrentEntry;
-    PNPFS_VCB Vcb;
-    PNPFS_FCB PipeFcb;
-    ULONG PipeIndex;
-    NTSTATUS Status = STATUS_SUCCESS;
-    PFILE_NAMES_INFORMATION NamesBuffer;
-    PFILE_DIRECTORY_INFORMATION DirectoryBuffer;
-    PFILE_FULL_DIR_INFORMATION FullDirBuffer;
-    PFILE_BOTH_DIR_INFORMATION BothDirBuffer;
-    ULONG InfoSize = 0;
-    ULONG NameLength;
-    ULONG CurrentOffset = 0;
-    ULONG LastOffset = 0;
-    PULONG NextEntryOffset;
-
-    Stack = IoGetCurrentIrpStackLocation(Irp);
-
-    /* Obtain the callers parameters */
-    BufferLength = Stack->Parameters.QueryDirectory.Length;
-    SearchPattern = Stack->Parameters.QueryDirectory.FileName;
-    FileInformationClass = Stack->Parameters.QueryDirectory.FileInformationClass;
-    FileIndex = Stack->Parameters.QueryDirectory.FileIndex;
-
-    DPRINT("SearchPattern: %p  '%wZ'\n", SearchPattern, SearchPattern);
-
-    /* Determine Buffer for result */
-    if (Irp->MdlAddress)
-    {
-        Buffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress,
-                                              NormalPagePriority);
-    }
-    else
-    {
-        Buffer = Irp->UserBuffer;
-    }
-
-    /* Build the search pattern string */
-    DPRINT("Ccb->u.Directory.SearchPattern.Buffer: %p\n", Ccb->u.Directory.SearchPattern.Buffer);
-    if (Ccb->u.Directory.SearchPattern.Buffer == NULL)
-    {
-        First = TRUE;
-
-        if (SearchPattern != NULL)
-        {
-            Ccb->u.Directory.SearchPattern.Buffer =
-                ExAllocatePoolWithTag(NonPagedPool,
-                                      SearchPattern->Length + sizeof(WCHAR),
-                                      TAG_NPFS_NAMEBLOCK);
-            if (Ccb->u.Directory.SearchPattern.Buffer == NULL)
-            {
-                return STATUS_INSUFFICIENT_RESOURCES;
-            }
-
-            Ccb->u.Directory.SearchPattern.Length = SearchPattern->Length;
-            Ccb->u.Directory.SearchPattern.MaximumLength = SearchPattern->Length + sizeof(WCHAR);
-            RtlCopyMemory(Ccb->u.Directory.SearchPattern.Buffer,
-                          SearchPattern->Buffer,
-                          SearchPattern->Length);
-            Ccb->u.Directory.SearchPattern.Buffer[SearchPattern->Length / sizeof(WCHAR)] = 0;
-        }
-        else
-        {
-            Ccb->u.Directory.SearchPattern.Buffer =
-                ExAllocatePoolWithTag(NonPagedPool,
-                                      2 * sizeof(WCHAR),
-                                      TAG_NPFS_NAMEBLOCK);
-            if (Ccb->u.Directory.SearchPattern.Buffer == NULL)
-            {
-                return STATUS_INSUFFICIENT_RESOURCES;
-            }
-
-            Ccb->u.Directory.SearchPattern.Length = sizeof(WCHAR);
-            Ccb->u.Directory.SearchPattern.MaximumLength = 2 * sizeof(WCHAR);
-            Ccb->u.Directory.SearchPattern.Buffer[0] = L'*';
-            Ccb->u.Directory.SearchPattern.Buffer[1] = 0;
-        }
-    }
-    DPRINT("Search pattern: '%wZ'\n", &Ccb->u.Directory.SearchPattern);
-
-    /* Determine the file index */
-    if (First || (Stack->Flags & SL_RESTART_SCAN))
-    {
-        FileIndex = 0;
-    }
-    else if ((Stack->Flags & SL_INDEX_SPECIFIED) == 0)
-    {
-        FileIndex = Ccb->u.Directory.FileIndex + 1;
-    }
-    DPRINT("FileIndex: %lu\n", FileIndex);
-
-    DPRINT("Buffer = %p  tofind = %wZ\n", Buffer, &Ccb->u.Directory.SearchPattern);
-
-    switch (FileInformationClass)
-    {
-        case FileDirectoryInformation:
-            InfoSize = sizeof(FILE_DIRECTORY_INFORMATION) - sizeof(WCHAR);
-            break;
-
-        case FileFullDirectoryInformation:
-            InfoSize = sizeof(FILE_FULL_DIR_INFORMATION) - sizeof(WCHAR);
-            break;
-
-        case FileBothDirectoryInformation:
-            InfoSize = sizeof(FILE_BOTH_DIR_INFORMATION) - sizeof(WCHAR);
-            break;
-
-        case FileNamesInformation:
-            InfoSize = sizeof(FILE_NAMES_INFORMATION) - sizeof(WCHAR);
-            break;
-
-        default:
-            DPRINT1("Invalid information class: %lu\n", FileInformationClass);
-            return STATUS_INVALID_INFO_CLASS;
-    }
-
-    PipeIndex = 0;
-
-    Vcb = Ccb->Fcb->Vcb;
-    KeLockMutex(&Vcb->PipeListLock);
-    CurrentEntry = Vcb->PipeListHead.Flink;
-    while (CurrentEntry != &Vcb->PipeListHead &&
-           Status == STATUS_SUCCESS)
-    {
-        /* Get the FCB of the next pipe */
-        PipeFcb = CONTAINING_RECORD(CurrentEntry,
-                                    NPFS_FCB,
-                                    PipeListEntry);
-
-        /* Make sure it is a pipe FCB */
-        ASSERT(PipeFcb->Type == FCB_PIPE);
-
-        DPRINT("PipeName: %wZ\n", &PipeFcb->PipeName);
-
-        if (FsRtlIsNameInExpression(&Ccb->u.Directory.SearchPattern,
-                                    &PipeFcb->PipeName,
-                                    TRUE,
-                                    NULL))
-        {
-            DPRINT("Found pipe: %wZ\n", &PipeFcb->PipeName);
-
-            if (PipeIndex >= FileIndex)
-            {
-                /* Determine whether or not the full pipe name fits into the buffer */
-                if (InfoSize + PipeFcb->PipeName.Length > BufferLength)
-                {
-                    NameLength = BufferLength - InfoSize;
-                    Status = STATUS_BUFFER_OVERFLOW;
-                }
-                else
-                {
-                    NameLength = PipeFcb->PipeName.Length;
-                    Status = STATUS_SUCCESS;
-                }
-
-                /* Initialize the information struct */
-                RtlZeroMemory(&Buffer[CurrentOffset], InfoSize);
-
-                switch (FileInformationClass)
-                {
-                    case FileDirectoryInformation:
-                        DirectoryBuffer = (PFILE_DIRECTORY_INFORMATION)&Buffer[CurrentOffset];
-                        DirectoryBuffer->FileIndex = PipeIndex;
-                        DirectoryBuffer->FileAttributes = FILE_ATTRIBUTE_NORMAL;
-                        DirectoryBuffer->EndOfFile.QuadPart = PipeFcb->CurrentInstances;
-                        DirectoryBuffer->AllocationSize.LowPart = PipeFcb->MaximumInstances;
-                        DirectoryBuffer->FileNameLength = NameLength;
-                        RtlCopyMemory(DirectoryBuffer->FileName,
-                                      PipeFcb->PipeName.Buffer,
-                                      NameLength);
-                        break;
-
-                    case FileFullDirectoryInformation:
-                        FullDirBuffer = (PFILE_FULL_DIR_INFORMATION)&Buffer[CurrentOffset];
-                        FullDirBuffer->FileIndex = PipeIndex;
-                        FullDirBuffer->FileAttributes = FILE_ATTRIBUTE_NORMAL;
-                        FullDirBuffer->EndOfFile.QuadPart = PipeFcb->CurrentInstances;
-                        FullDirBuffer->AllocationSize.LowPart = PipeFcb->MaximumInstances;
-                        FullDirBuffer->FileNameLength = NameLength;
-                        RtlCopyMemory(FullDirBuffer->FileName,
-                                      PipeFcb->PipeName.Buffer,
-                                      NameLength);
-                        break;
-
-                    case FileBothDirectoryInformation:
-                        BothDirBuffer = (PFILE_BOTH_DIR_INFORMATION)&Buffer[CurrentOffset];
-                        BothDirBuffer->NextEntryOffset = 0;
-                        BothDirBuffer->FileIndex = PipeIndex;
-                        BothDirBuffer->FileAttributes = FILE_ATTRIBUTE_NORMAL;
-                        BothDirBuffer->EndOfFile.QuadPart = PipeFcb->CurrentInstances;
-                        BothDirBuffer->AllocationSize.LowPart = PipeFcb->MaximumInstances;
-                        BothDirBuffer->FileNameLength = NameLength;
-                        RtlCopyMemory(BothDirBuffer->FileName,
-                                      PipeFcb->PipeName.Buffer,
-                                      NameLength);
-                        break;
-
-                    case FileNamesInformation:
-                        NamesBuffer = (PFILE_NAMES_INFORMATION)&Buffer[CurrentOffset];
-                        NamesBuffer->FileIndex = PipeIndex;
-                        NamesBuffer->FileNameLength = NameLength;
-                        RtlCopyMemory(NamesBuffer->FileName,
-                                      PipeFcb->PipeName.Buffer,
-                                      NameLength);
-                        break;
-
-                    default:
-                        /* Should never happen! */
-                        ASSERT(FALSE);
-                        break;
-                }
-
-                DPRINT("CurrentOffset: %lu\n", CurrentOffset);
-
-                /* Store the current pipe index in the CCB */
-                Ccb->u.Directory.FileIndex = PipeIndex;
-
-                /* Get the pointer to the previous entries NextEntryOffset */
-                NextEntryOffset = (PULONG)&Buffer[LastOffset];
-
-                /* Set the previous entries NextEntryOffset */
-                *NextEntryOffset = CurrentOffset - LastOffset;
-
-                /* Return the used buffer size */
-                *Size = CurrentOffset + InfoSize + NameLength;
-
-                /* Leave, if there is no space left in the buffer */
-                if (Status == STATUS_BUFFER_OVERFLOW)
-                {
-                    KeUnlockMutex(&Vcb->PipeListLock);
-                    return Status;
-                }
-
-                /* Leave, if we should return only one entry */
-                if (Stack->Flags & SL_RETURN_SINGLE_ENTRY)
-                {
-                    KeUnlockMutex(&Vcb->PipeListLock);
-                    return STATUS_SUCCESS;
-                }
-
-                /* Store the current offset for the next round */
-                LastOffset = CurrentOffset;
-
-                /* Set the offset for the next entry */
-                CurrentOffset += ROUND_UP(InfoSize + NameLength, sizeof(ULONG));
-            }
-
-            PipeIndex++;
-        }
-
-        CurrentEntry = CurrentEntry->Flink;
-    }
-    KeUnlockMutex(&Vcb->PipeListLock);
-
-    /* Return STATUS_NO_MORE_FILES if no matching pipe name was found */
-    if (CurrentOffset == 0)
-        Status = STATUS_NO_MORE_FILES;
-
-    return Status;
-}
-
-
-NTSTATUS NTAPI
-NpfsDirectoryControl(PDEVICE_OBJECT DeviceObject,
-                     PIRP Irp)
-{
-    PIO_STACK_LOCATION IoStack;
-    PFILE_OBJECT FileObject;
-    PNPFS_CCB Ccb;
-    //PNPFS_FCB Fcb;
-    NTSTATUS Status;
-    ULONG Size = 0;
-
-    UNREFERENCED_PARAMETER(DeviceObject);
-
-    DPRINT("NpfsDirectoryControl() called\n");
-
-    IoStack = IoGetCurrentIrpStackLocation(Irp);
-
-    FileObject = IoStack->FileObject;
-
-    if (NpfsGetCcb(FileObject, &Ccb) != CCB_DIRECTORY)
-    {
-        Status = STATUS_INVALID_PARAMETER;
-
-        Irp->IoStatus.Status = Status;
-        Irp->IoStatus.Information = 0;
-
-        IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
-        return Status;
-    }
-
-    //Fcb = Ccb->Fcb;
-
-    switch (IoStack->MinorFunction)
-    {
-        case IRP_MN_QUERY_DIRECTORY:
-            Status = NpfsQueryDirectory(Ccb,
-                                        Irp,
-                                        &Size);
-            break;
-
-        case IRP_MN_NOTIFY_CHANGE_DIRECTORY:
-            DPRINT1("IRP_MN_NOTIFY_CHANGE_DIRECTORY\n");
-            Status = STATUS_NOT_IMPLEMENTED;
-            break;
-
-        default:
-            DPRINT1("NPFS: MinorFunction %d\n", IoStack->MinorFunction);
-            Status = STATUS_INVALID_DEVICE_REQUEST;
-            break;
-    }
-
-    Irp->IoStatus.Status = Status;
-    Irp->IoStatus.Information = Size;
-
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
-    return Status;
-}
-
-/* EOF */
diff --git a/drivers/filesystems/npfs/finfo.c b/drivers/filesystems/npfs/finfo.c
deleted file mode 100644 (file)
index 03c9a60..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
-* COPYRIGHT:  See COPYING in the top level directory
-* PROJECT:    ReactOS kernel
-* FILE:       drivers/filesystems/npfs/finfo.c
-* PURPOSE:    Named pipe filesystem
-* PROGRAMMER: Eric Kohl
-*/
-
-/* INCLUDES ******************************************************************/
-
-#include "npfs.h"
-
-#define NDEBUG
-#include <debug.h>
-
-/* FUNCTIONS *****************************************************************/
-
-static
-NTSTATUS
-NpfsSetPipeInformation(PDEVICE_OBJECT DeviceObject,
-                       PNPFS_CCB Ccb,
-                       PFILE_PIPE_INFORMATION Info,
-                       PULONG BufferLength)
-{
-    PNPFS_FCB Fcb;
-    PFILE_PIPE_INFORMATION Request;
-
-    UNREFERENCED_PARAMETER(DeviceObject);
-
-    DPRINT("NpfsSetPipeInformation()\n");
-
-    if (*BufferLength < sizeof(FILE_PIPE_INFORMATION))
-    {
-        /* Buffer too small */
-        return STATUS_INFO_LENGTH_MISMATCH;
-    }
-
-
-    /* Get the Pipe and data */
-    Fcb = Ccb->Fcb;
-    Request = (PFILE_PIPE_INFORMATION)Info;
-
-    if ((Fcb->PipeType == FILE_PIPE_BYTE_STREAM_TYPE) && (Request->ReadMode == FILE_PIPE_MESSAGE_MODE))
-    {
-        DPRINT("Cannot change readmode to message type on a byte type pipe!\n");
-        return STATUS_ACCESS_DENIED;
-    }
-
-    /* Set Pipe Data */
-    if (Ccb->PipeEnd == FILE_PIPE_CLIENT_END)
-    {
-        Fcb->ClientReadMode = Request->ReadMode;
-    }
-    else
-    {
-        Fcb->ServerReadMode = Request->ReadMode;
-    }
-
-    Fcb->CompletionMode =  Request->CompletionMode;
-
-    /* Return Success */
-    return STATUS_SUCCESS;
-}
-
-static
-NTSTATUS
-NpfsSetPipeRemoteInformation(PDEVICE_OBJECT DeviceObject,
-                             PNPFS_CCB Ccb,
-                             PFILE_PIPE_INFORMATION Info,
-                             PULONG BufferLength)
-{
-    PNPFS_FCB Fcb;
-    PFILE_PIPE_REMOTE_INFORMATION Request;
-
-    UNREFERENCED_PARAMETER(DeviceObject);
-
-    DPRINT("NpfsSetPipeRemoteInformation()\n");
-
-    if (*BufferLength < sizeof(FILE_PIPE_REMOTE_INFORMATION))
-    {
-        /* Buffer too small */
-        return STATUS_INFO_LENGTH_MISMATCH;
-    }
-
-    /* Get the Pipe and data */
-    Fcb = Ccb->Fcb;
-    Request = (PFILE_PIPE_REMOTE_INFORMATION)Info;
-
-    /* Set the Settings */
-    Fcb->TimeOut = Request->CollectDataTime;
-    Fcb->InboundQuota = Request->MaximumCollectionCount;
-
-    /* Return Success */
-    return STATUS_SUCCESS;
-}
-
-static
-NTSTATUS
-NpfsQueryPipeInformation(PDEVICE_OBJECT DeviceObject,
-                         PNPFS_CCB Ccb,
-                         PFILE_PIPE_INFORMATION Info,
-                         PULONG BufferLength)
-{
-    PNPFS_FCB Fcb;
-    ULONG ConnectionSideReadMode;
-
-    UNREFERENCED_PARAMETER(DeviceObject);
-
-    DPRINT("NpfsQueryPipeInformation()\n");
-
-    if (*BufferLength < sizeof(FILE_PIPE_INFORMATION))
-    {
-        /* Buffer too small */
-        *BufferLength = sizeof(FILE_PIPE_INFORMATION);
-        return STATUS_BUFFER_OVERFLOW;
-    }
-
-    /* Get the Pipe */
-    Fcb = Ccb->Fcb;
-
-    /* Clear Info */
-    RtlZeroMemory(Info, sizeof(FILE_PIPE_INFORMATION));
-
-    if (Ccb->PipeEnd == FILE_PIPE_CLIENT_END) ConnectionSideReadMode=Ccb->Fcb->ClientReadMode;
-    else ConnectionSideReadMode = Ccb->Fcb->ServerReadMode;
-
-    /* Return Info */
-    Info->CompletionMode = Fcb->CompletionMode;
-    Info->ReadMode = ConnectionSideReadMode;
-
-    /* Return success */
-    *BufferLength = sizeof(FILE_PIPE_INFORMATION);
-    return STATUS_SUCCESS;
-}
-
-static
-NTSTATUS
-NpfsQueryPipeRemoteInformation(PDEVICE_OBJECT DeviceObject,
-                               PNPFS_CCB Ccb,
-                               PFILE_PIPE_REMOTE_INFORMATION Info,
-                               PULONG BufferLength)
-{
-    PNPFS_FCB Fcb;
-
-    UNREFERENCED_PARAMETER(DeviceObject);
-
-    DPRINT("NpfsQueryPipeRemoteInformation()\n");
-
-    if (*BufferLength < sizeof(FILE_PIPE_REMOTE_INFORMATION))
-    {
-        /* Buffer too small */
-        *BufferLength = sizeof(FILE_PIPE_REMOTE_INFORMATION);
-        return STATUS_BUFFER_OVERFLOW;
-    }
-
-    /* Get the Pipe */
-    Fcb = Ccb->Fcb;
-
-    /* Clear Info */
-    RtlZeroMemory(Info, sizeof(FILE_PIPE_REMOTE_INFORMATION));
-
-    /* Return Info */
-    Info->MaximumCollectionCount = Fcb->InboundQuota;
-    Info->CollectDataTime = Fcb->TimeOut;
-
-    /* Return success */
-    *BufferLength = sizeof(FILE_PIPE_REMOTE_INFORMATION);
-    return STATUS_SUCCESS;
-}
-
-
-static NTSTATUS
-NpfsQueryLocalPipeInformation(PDEVICE_OBJECT DeviceObject,
-                              PNPFS_CCB Ccb,
-                              PFILE_PIPE_LOCAL_INFORMATION Info,
-                              PULONG BufferLength)
-{
-    PNPFS_FCB Fcb;
-
-    UNREFERENCED_PARAMETER(DeviceObject);
-
-    DPRINT("NpfsQueryLocalPipeInformation()\n");
-
-    if (*BufferLength < sizeof(FILE_PIPE_REMOTE_INFORMATION))
-    {
-        /* Buffer too small */
-        *BufferLength = sizeof(FILE_PIPE_REMOTE_INFORMATION);
-        return STATUS_BUFFER_OVERFLOW;
-    }
-
-    /* Get the Pipe */
-    Fcb = Ccb->Fcb;
-
-    /* Clear Info */
-    RtlZeroMemory(Info,
-        sizeof(FILE_PIPE_LOCAL_INFORMATION));
-
-    /* Return Info */
-    Info->NamedPipeType = Fcb->PipeType;
-    Info->NamedPipeConfiguration = Fcb->PipeConfiguration;
-    Info->MaximumInstances = Fcb->MaximumInstances;
-    Info->CurrentInstances = Fcb->CurrentInstances;
-    Info->InboundQuota = Fcb->InboundQuota;
-    Info->OutboundQuota = Fcb->OutboundQuota;
-    Info->NamedPipeState = Ccb->PipeState;
-    Info->NamedPipeEnd = Ccb->PipeEnd;
-
-    if (Ccb->PipeEnd == FILE_PIPE_SERVER_END)
-    {
-        Info->ReadDataAvailable = Ccb->ReadDataAvailable;
-        Info->WriteQuotaAvailable = Ccb->WriteQuotaAvailable;
-    }
-    else if (Ccb->OtherSide != NULL)
-    {
-        Info->ReadDataAvailable = Ccb->OtherSide->ReadDataAvailable;
-        Info->WriteQuotaAvailable = Ccb->OtherSide->WriteQuotaAvailable;
-    }
-
-    *BufferLength = sizeof(FILE_PIPE_LOCAL_INFORMATION);
-    return STATUS_SUCCESS;
-}
-
-
-NTSTATUS NTAPI
-NpfsQueryInformation(PDEVICE_OBJECT DeviceObject,
-                     PIRP Irp)
-{
-    PIO_STACK_LOCATION IoStack;
-    FILE_INFORMATION_CLASS FileInformationClass;
-    PFILE_OBJECT FileObject;
-    //PNPFS_VCB Vcb;
-    PNPFS_FCB Fcb;
-    PNPFS_CCB Ccb;
-    PVOID SystemBuffer;
-    ULONG BufferLength;
-    NTSTATUS Status;
-
-    DPRINT("NpfsQueryInformation(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
-
-    IoStack = IoGetCurrentIrpStackLocation (Irp);
-    FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
-    //Vcb = (PNPFS_VCB)DeviceObject->DeviceExtension;
-    FileObject = IoStack->FileObject;
-    Ccb = (PNPFS_CCB)FileObject->FsContext2;
-    Fcb = Ccb->Fcb;
-
-    SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
-    BufferLength = IoStack->Parameters.QueryFile.Length;
-
-    DPRINT("Pipe name: %wZ\n", &Fcb->PipeName);
-    DPRINT("FileInformationClass %d\n", FileInformationClass);
-    DPRINT("SystemBuffer %p\n", SystemBuffer);
-    DPRINT("BufferLength %lu\n", BufferLength);
-
-    switch (FileInformationClass)
-    {
-    case FilePipeInformation:
-        Status = NpfsQueryPipeInformation(DeviceObject,
-            Ccb,
-            SystemBuffer,
-            &BufferLength);
-        break;
-
-    case FilePipeLocalInformation:
-        Status = NpfsQueryLocalPipeInformation(DeviceObject,
-            Ccb,
-            SystemBuffer,
-            &BufferLength);
-        break;
-
-    case FilePipeRemoteInformation:
-        Status = NpfsQueryPipeRemoteInformation(DeviceObject,
-            Ccb,
-            SystemBuffer,
-            &BufferLength);
-        break;
-
-    default:
-        Status = STATUS_NOT_SUPPORTED;
-        BufferLength = 0;
-    }
-
-    Irp->IoStatus.Status = Status;
-    Irp->IoStatus.Information = BufferLength;
-
-    IoCompleteRequest (Irp, IO_NO_INCREMENT);
-
-    return Status;
-}
-
-
-NTSTATUS NTAPI
-NpfsSetInformation(PDEVICE_OBJECT DeviceObject,
-                   PIRP Irp)
-{
-    PIO_STACK_LOCATION IoStack;
-    FILE_INFORMATION_CLASS FileInformationClass;
-    PFILE_OBJECT FileObject;
-    PNPFS_FCB Fcb;
-    PNPFS_CCB Ccb;
-    PVOID SystemBuffer;
-    ULONG BufferLength;
-    NTSTATUS Status;
-
-    DPRINT("NpfsSetInformation(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
-
-    IoStack = IoGetCurrentIrpStackLocation (Irp);
-    FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
-    FileObject = IoStack->FileObject;
-    Ccb = (PNPFS_CCB)FileObject->FsContext2;
-    Fcb = Ccb->Fcb;
-
-    SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
-    BufferLength = IoStack->Parameters.QueryFile.Length;
-
-    DPRINT("Pipe name: %wZ\n", &Fcb->PipeName);
-    DPRINT("FileInformationClass %d\n", FileInformationClass);
-    DPRINT("SystemBuffer %p\n", SystemBuffer);
-    DPRINT("BufferLength %lu\n", BufferLength);
-
-    switch (FileInformationClass)
-    {
-    case FilePipeInformation:
-        /* Call the handler */
-        Status = NpfsSetPipeInformation(DeviceObject,
-            Ccb,
-            SystemBuffer,
-            &BufferLength);
-        break;
-
-    case FilePipeLocalInformation:
-        Status = STATUS_NOT_IMPLEMENTED;
-        break;
-
-    case FilePipeRemoteInformation:
-        /* Call the handler */
-        Status = NpfsSetPipeRemoteInformation(DeviceObject,
-            Ccb,
-            SystemBuffer,
-            &BufferLength);
-        break;
-    default:
-        Status = STATUS_NOT_SUPPORTED;
-    }
-
-    Irp->IoStatus.Status = Status;
-    Irp->IoStatus.Information = 0;
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-    return Status;
-}
-
-/* EOF */
diff --git a/drivers/filesystems/npfs/npfs.c b/drivers/filesystems/npfs/npfs.c
deleted file mode 100644 (file)
index f166300..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
-* COPYRIGHT:  See COPYING in the top level directory
-* PROJECT:    ReactOS kernel
-* FILE:       drivers/filesystems/npfs/npfs.c
-* PURPOSE:    Named pipe filesystem
-* PROGRAMMER: David Welch <welch@cwcom.net>
-*/
-
-/* INCLUDES ******************************************************************/
-
-#include "npfs.h"
-
-#define NDEBUG
-#include <debug.h>
-
-/* FUNCTIONS *****************************************************************/
-
-NTSTATUS NTAPI
-DriverEntry(PDRIVER_OBJECT DriverObject,
-            PUNICODE_STRING RegistryPath)
-{
-    PDEVICE_OBJECT DeviceObject;
-    UNICODE_STRING DeviceName;
-    PNPFS_VCB Vcb;
-    PNPFS_FCB Fcb;
-    NTSTATUS Status;
-
-    UNREFERENCED_PARAMETER(RegistryPath);
-
-    DPRINT("Named Pipe FSD 0.0.2\n");
-
-    ASSERT (sizeof(NPFS_CONTEXT) <= FIELD_OFFSET(IRP, Tail.Overlay.DriverContext));
-    ASSERT (sizeof(NPFS_WAITER_ENTRY) <= FIELD_OFFSET(IRP, Tail.Overlay.DriverContext));
-
-    DriverObject->MajorFunction[IRP_MJ_CREATE] = NpfsCreate;
-    DriverObject->MajorFunction[IRP_MJ_CREATE_NAMED_PIPE] =
-        NpfsCreateNamedPipe;
-    DriverObject->MajorFunction[IRP_MJ_CLOSE] = NpfsClose;
-    DriverObject->MajorFunction[IRP_MJ_READ] = NpfsRead;
-    DriverObject->MajorFunction[IRP_MJ_WRITE] = NpfsWrite;
-    DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
-        NpfsQueryInformation;
-    DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
-        NpfsSetInformation;
-    DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] =
-        NpfsQueryVolumeInformation;
-    DriverObject->MajorFunction[IRP_MJ_CLEANUP] = NpfsCleanup;
-    DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = NpfsFlushBuffers;
-    DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
-        NpfsDirectoryControl;
-    DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
-        NpfsFileSystemControl;
-    //   DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] =
-    //     NpfsQuerySecurity;
-    //   DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] =
-    //     NpfsSetSecurity;
-
-    DriverObject->DriverUnload = NULL;
-
-    RtlInitUnicodeString(&DeviceName, L"\\Device\\NamedPipe");
-    Status = IoCreateDevice(DriverObject,
-        sizeof(NPFS_VCB),
-        &DeviceName,
-        FILE_DEVICE_NAMED_PIPE,
-        0,
-        FALSE,
-        &DeviceObject);
-    if (!NT_SUCCESS(Status))
-    {
-        DPRINT1("Failed to create named pipe device! (Status %lx)\n", Status);
-        return Status;
-    }
-
-    /* Initialize the device object */
-    DeviceObject->Flags |= DO_DIRECT_IO;
-    DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
-
-    /* Initialize the Volume Control Block (VCB) */
-    Vcb = (PNPFS_VCB)DeviceObject->DeviceExtension;
-    InitializeListHead(&Vcb->PipeListHead);
-    InitializeListHead(&Vcb->ThreadListHead);
-    KeInitializeMutex(&Vcb->PipeListLock, 0);
-    Vcb->EmptyWaiterCount = 0;
-
-    /* set the size quotas */
-    Vcb->MinQuota = PAGE_SIZE;
-    Vcb->DefaultQuota = 8 * PAGE_SIZE;
-    Vcb->MaxQuota = 64 * PAGE_SIZE;
-
-    /* Create the device FCB */
-    Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(NPFS_FCB), TAG_NPFS_FCB);
-    if (!Fcb)
-    {
-        DPRINT1("Out of memory for device FCB!\n");
-        IoDeleteDevice(DeviceObject);
-        return STATUS_INSUFFICIENT_RESOURCES;
-    }
-    Fcb->Type = FCB_DEVICE;
-    Fcb->Vcb = Vcb;
-    Fcb->RefCount = 1;
-    Vcb->DeviceFcb = Fcb;
-
-    /* Create the root directory FCB */
-    Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(NPFS_FCB), TAG_NPFS_FCB);
-    if (!Fcb)
-    {
-        DPRINT1("Out of memory for root FCB!\n");
-        IoDeleteDevice(DeviceObject);
-        ExFreePoolWithTag(Vcb->DeviceFcb, TAG_NPFS_FCB);
-        return STATUS_INSUFFICIENT_RESOURCES;
-    }
-    Fcb->Type = FCB_DIRECTORY;
-    Fcb->Vcb = Vcb;
-    Fcb->RefCount = 1;
-    Vcb->RootFcb = Fcb;
-
-    return STATUS_SUCCESS;
-}
-
-
-FCB_TYPE
-NpfsGetFcb(PFILE_OBJECT FileObject,
-           PNPFS_FCB *Fcb)
-{
-    PNPFS_FCB LocalFcb = NULL;
-    FCB_TYPE FcbType = FCB_INVALID;
-
-    _SEH2_TRY
-    {
-        LocalFcb = (PNPFS_FCB)FileObject->FsContext;
-        FcbType = LocalFcb->Type;
-    }
-    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
-    {
-        LocalFcb = NULL;
-        FcbType = FCB_INVALID;
-    }
-    _SEH2_END;
-
-    *Fcb = LocalFcb;
-
-    return FcbType;
-}
-
-
-CCB_TYPE
-NpfsGetCcb(PFILE_OBJECT FileObject,
-           PNPFS_CCB *Ccb)
-{
-    PNPFS_CCB LocalCcb = NULL;
-    CCB_TYPE CcbType = CCB_INVALID;
-
-    _SEH2_TRY
-    {
-        LocalCcb = (PNPFS_CCB)FileObject->FsContext2;
-        CcbType = LocalCcb->Type;
-    }
-    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
-    {
-        LocalCcb = NULL;
-        CcbType = CCB_INVALID;
-    }
-    _SEH2_END;
-
-    *Ccb = LocalCcb;
-
-    return CcbType;
-}
-
-/* EOF */
diff --git a/drivers/filesystems/npfs/rw.c b/drivers/filesystems/npfs/rw.c
deleted file mode 100644 (file)
index 18f9928..0000000
+++ /dev/null
@@ -1,986 +0,0 @@
-/*
-* COPYRIGHT:  See COPYING in the top level directory
-* PROJECT:    ReactOS kernel
-* FILE:       drivers/filesystems/npfs/rw.c
-* PURPOSE:    Named pipe filesystem
-* PROGRAMMER: David Welch <welch@cwcom.net>
-*             Michael Martin
-*/
-
-/* INCLUDES ******************************************************************/
-
-#include "npfs.h"
-
-#define NDEBUG
-#include <debug.h>
-
-/* FUNCTIONS *****************************************************************/
-
-VOID HexDump(PUCHAR Buffer, ULONG Length)
-{
-    CHAR Line[65];
-    UCHAR ch;
-    const char Hex[] = "0123456789ABCDEF";
-    ULONG i, j;
-
-    DbgPrint("---------------\n");
-
-    for (i = 0; i < Length; i+= 16)
-    {
-        memset(Line, ' ', 64);
-        Line[64] = 0;
-
-        for (j = 0; j < 16 && j + i < Length; j++)
-        {
-            ch = Buffer[i + j];
-            Line[3*j + 0] = Hex[ch >> 4];
-            Line[3*j + 1] = Hex[ch & 0x0f];
-            Line[48 + j] = isprint(ch) ? ch : '.';
-        }
-        DbgPrint("%s\n", Line);
-    }
-    DbgPrint("---------------\n");
-}
-
-static DRIVER_CANCEL NpfsReadWriteCancelRoutine;
-static VOID NTAPI
-NpfsReadWriteCancelRoutine(IN PDEVICE_OBJECT DeviceObject,
-                           IN PIRP Irp)
-{
-    PNPFS_CONTEXT Context;
-    PIO_STACK_LOCATION IoStack;
-    PNPFS_VCB Vcb;
-    PNPFS_CCB Ccb;
-    PLIST_ENTRY ListEntry;
-    PNPFS_THREAD_CONTEXT ThreadContext;
-    ULONG i;
-
-    DPRINT("NpfsReadWriteCancelRoutine(DeviceObject %p, Irp %p)\n", DeviceObject, Irp);
-
-    IoReleaseCancelSpinLock(Irp->CancelIrql);
-
-    Context = (PNPFS_CONTEXT)&Irp->Tail.Overlay.DriverContext;
-    Vcb = (PNPFS_VCB)DeviceObject->DeviceExtension;
-    IoStack = IoGetCurrentIrpStackLocation(Irp);
-    Ccb = IoStack->FileObject->FsContext2;
-
-    KeLockMutex(&Vcb->PipeListLock);
-    ExAcquireFastMutex(&Ccb->DataListLock);
-    switch(IoStack->MajorFunction)
-    {
-    case IRP_MJ_READ:
-        ListEntry = Vcb->ThreadListHead.Flink;
-        while (ListEntry != &Vcb->ThreadListHead)
-        {
-            ThreadContext = CONTAINING_RECORD(ListEntry, NPFS_THREAD_CONTEXT, ListEntry);
-            /* Real events start at index 1 */
-            for (i = 1; i < ThreadContext->Count; i++)
-            {
-                if (ThreadContext->WaitIrpArray[i] == Irp)
-                {
-                    ASSERT(ThreadContext->WaitObjectArray[i] == Context->WaitEvent);
-
-                    ThreadContext->WaitIrpArray[i] = NULL;
-
-                    RemoveEntryList(&Context->ListEntry);
-
-                    Irp->IoStatus.Status = STATUS_CANCELLED;
-                    Irp->IoStatus.Information = 0;
-
-                    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
-                    KeSetEvent(&ThreadContext->Event, IO_NO_INCREMENT, FALSE);
-
-                    ExReleaseFastMutex(&Ccb->DataListLock);
-                    KeUnlockMutex(&Vcb->PipeListLock);
-
-                    return;
-                }
-            }
-            ListEntry = ListEntry->Flink;
-        }
-
-        RemoveEntryList(&Context->ListEntry);
-
-        ExReleaseFastMutex(&Ccb->DataListLock);
-        KeUnlockMutex(&Vcb->PipeListLock);
-
-        Irp->IoStatus.Status = STATUS_CANCELLED;
-        Irp->IoStatus.Information = 0;
-
-        IoCompleteRequest(Irp, IO_NO_INCREMENT);
-        break;
-    default:
-        ASSERT(FALSE);
-    }
-}
-
-static KSTART_ROUTINE NpfsWaiterThread;
-static VOID NTAPI
-NpfsWaiterThread(PVOID InitContext)
-{
-    PNPFS_THREAD_CONTEXT ThreadContext = InitContext;
-    ULONG CurrentCount;
-    ULONG Count = 0, i;
-    PIRP Irp = NULL;
-    NTSTATUS Status;
-    PIO_STACK_LOCATION IoStack = NULL;
-    KIRQL OldIrql;
-
-    KeLockMutex(&ThreadContext->Vcb->PipeListLock);
-
-    while (1)
-    {
-        CurrentCount = ThreadContext->Count;
-        KeUnlockMutex(&ThreadContext->Vcb->PipeListLock);
-        IoAcquireCancelSpinLock(&OldIrql);
-        if (Irp && IoSetCancelRoutine(Irp, NULL) != NULL)
-        {
-            IoReleaseCancelSpinLock(OldIrql);
-            IoStack = IoGetCurrentIrpStackLocation(Irp);
-            switch (IoStack->MajorFunction)
-            {
-                case IRP_MJ_READ:
-                    NpfsRead(IoStack->DeviceObject, Irp);
-                    break;
-                default:
-                    ASSERT(FALSE);
-            }
-        }
-        else
-        {
-            IoReleaseCancelSpinLock(OldIrql);
-        }
-        Status = KeWaitForMultipleObjects(CurrentCount,
-            ThreadContext->WaitObjectArray,
-            WaitAny,
-            Executive,
-            KernelMode,
-            FALSE,
-            NULL,
-            ThreadContext->WaitBlockArray);
-        if (!NT_SUCCESS(Status))
-        {
-            ASSERT(FALSE);
-        }
-        KeLockMutex(&ThreadContext->Vcb->PipeListLock);
-        Count = Status - STATUS_WAIT_0;
-        ASSERT (Count < CurrentCount);
-        if (Count > 0)
-        {
-            Irp = ThreadContext->WaitIrpArray[Count];
-            ThreadContext->Count--;
-            ThreadContext->Vcb->EmptyWaiterCount++;
-            ThreadContext->WaitObjectArray[Count] = ThreadContext->WaitObjectArray[ThreadContext->Count];
-            ThreadContext->WaitIrpArray[Count] = ThreadContext->WaitIrpArray[ThreadContext->Count];
-        }
-        else
-        {
-            /* someone has added a new wait request or cancelled an old one */
-            Irp = NULL;
-
-            /* Look for cancelled requests */
-            for (i = 1; i < ThreadContext->Count; i++)
-            {
-                if (ThreadContext->WaitIrpArray[i] == NULL)
-                {
-                    ThreadContext->Count--;
-                    ThreadContext->Vcb->EmptyWaiterCount++;
-                    ThreadContext->WaitObjectArray[i] = ThreadContext->WaitObjectArray[ThreadContext->Count];
-                    ThreadContext->WaitIrpArray[i] = ThreadContext->WaitIrpArray[ThreadContext->Count];
-                }
-            }
-        }
-        if (ThreadContext->Count == 1 && ThreadContext->Vcb->EmptyWaiterCount >= MAXIMUM_WAIT_OBJECTS)
-        {
-            /* there is another thread with empty wait slots, we can remove our thread from the list */
-            ASSERT(Irp == NULL);
-            ThreadContext->Vcb->EmptyWaiterCount -= MAXIMUM_WAIT_OBJECTS - 1;
-            RemoveEntryList(&ThreadContext->ListEntry);
-            KeUnlockMutex(&ThreadContext->Vcb->PipeListLock);
-            ExFreePoolWithTag(ThreadContext, TAG_NPFS_THREAD_CONTEXT);
-            break;
-        }
-    }
-}
-
-static NTSTATUS
-NpfsAddWaitingReadWriteRequest(IN PDEVICE_OBJECT DeviceObject,
-                               IN PIRP Irp)
-{
-    PLIST_ENTRY ListEntry;
-    PNPFS_THREAD_CONTEXT ThreadContext = NULL;
-    PNPFS_CONTEXT Context;
-    HANDLE hThread;
-    PNPFS_VCB Vcb;
-    KIRQL oldIrql;
-    NTSTATUS Status;
-
-    Context = (PNPFS_CONTEXT)&Irp->Tail.Overlay.DriverContext;
-    Vcb = (PNPFS_VCB)DeviceObject->DeviceExtension;
-
-    DPRINT("NpfsAddWaitingReadWriteRequest(DeviceObject %p, Irp %p)\n", DeviceObject, Irp);
-
-    KeLockMutex(&Vcb->PipeListLock);
-
-    ListEntry = Vcb->ThreadListHead.Flink;
-    while (ListEntry != &Vcb->ThreadListHead)
-    {
-        ThreadContext = CONTAINING_RECORD(ListEntry, NPFS_THREAD_CONTEXT, ListEntry);
-        if (ThreadContext->Count < MAXIMUM_WAIT_OBJECTS)
-        {
-            break;
-        }
-        ListEntry = ListEntry->Flink;
-    }
-
-    if (ListEntry == &Vcb->ThreadListHead)
-    {
-        ThreadContext = ExAllocatePoolWithTag(NonPagedPool,
-                                              sizeof(NPFS_THREAD_CONTEXT),
-                                              TAG_NPFS_THREAD_CONTEXT);
-        if (ThreadContext == NULL)
-        {
-            KeUnlockMutex(&Vcb->PipeListLock);
-            return STATUS_NO_MEMORY;
-        }
-
-        ThreadContext->Vcb = Vcb;
-        KeInitializeEvent(&ThreadContext->Event, SynchronizationEvent, FALSE);
-        ThreadContext->Count = 1;
-        ThreadContext->WaitObjectArray[0] = &ThreadContext->Event;
-
-        DPRINT("Creating a new system thread for waiting read/write requests\n");
-
-        Status = PsCreateSystemThread(&hThread,
-            THREAD_ALL_ACCESS,
-            NULL,
-            NULL,
-            NULL,
-            NpfsWaiterThread,
-            (PVOID)ThreadContext);
-        if (!NT_SUCCESS(Status))
-        {
-            ExFreePoolWithTag(ThreadContext, TAG_NPFS_THREAD_CONTEXT);
-            KeUnlockMutex(&Vcb->PipeListLock);
-            return Status;
-        }
-
-        InsertHeadList(&Vcb->ThreadListHead, &ThreadContext->ListEntry);
-        Vcb->EmptyWaiterCount += MAXIMUM_WAIT_OBJECTS - 1;
-    }
-    IoMarkIrpPending(Irp);
-
-    IoAcquireCancelSpinLock(&oldIrql);
-    if (Irp->Cancel)
-    {
-        IoReleaseCancelSpinLock(oldIrql);
-        Status = STATUS_CANCELLED;
-    }
-    else
-    {
-        (void)IoSetCancelRoutine(Irp, NpfsReadWriteCancelRoutine);
-        IoReleaseCancelSpinLock(oldIrql);
-        ThreadContext->WaitObjectArray[ThreadContext->Count] = Context->WaitEvent;
-        ThreadContext->WaitIrpArray[ThreadContext->Count] = Irp;
-        ThreadContext->Count++;
-        Vcb->EmptyWaiterCount--;
-        KeSetEvent(&ThreadContext->Event, IO_NO_INCREMENT, FALSE);
-        Status = STATUS_SUCCESS;
-    }
-    KeUnlockMutex(&Vcb->PipeListLock);
-    return Status;
-}
-
-NTSTATUS NTAPI
-NpfsRead(IN PDEVICE_OBJECT DeviceObject,
-         IN PIRP Irp)
-{
-    PFILE_OBJECT FileObject;
-    NTSTATUS Status;
-    NTSTATUS OriginalStatus = STATUS_SUCCESS;
-    PNPFS_CCB Ccb;
-    PNPFS_CONTEXT Context;
-    KEVENT Event;
-    ULONG Length;
-    ULONG Information = 0;
-    ULONG CopyLength = 0;
-    ULONG TempLength;
-    BOOLEAN IsOriginalRequest = TRUE;
-    PVOID Buffer;
-
-    DPRINT("NpfsRead(DeviceObject %p, Irp %p)\n", DeviceObject, Irp);
-
-    FileObject = IoGetCurrentIrpStackLocation(Irp)->FileObject;
-    DPRINT("FileObject %p\n", FileObject);
-    DPRINT("Pipe name %wZ\n", &FileObject->FileName);
-    Ccb = FileObject->FsContext2;
-
-    /* Fail, if the CCB is not a pipe CCB */
-    if (Ccb->Type != CCB_PIPE)
-    {
-        DPRINT("Not a pipe!\n");
-        Status = STATUS_INVALID_PARAMETER;
-        Irp->IoStatus.Information = 0;
-        goto done;
-    }
-
-    if (Irp->MdlAddress == NULL)
-    {
-        DPRINT("Irp->MdlAddress == NULL\n");
-        Status = STATUS_UNSUCCESSFUL;
-        Irp->IoStatus.Information = 0;
-        goto done;
-    }
-
-    Context = (PNPFS_CONTEXT)&Irp->Tail.Overlay.DriverContext;
-
-    if ((Ccb->OtherSide) && (Ccb->OtherSide->PipeState == FILE_PIPE_DISCONNECTED_STATE) && (Ccb->PipeState == FILE_PIPE_DISCONNECTED_STATE))
-    {
-        DPRINT("Both Client and Server are disconnected!\n");
-        Status = STATUS_PIPE_DISCONNECTED;
-        Irp->IoStatus.Information = 0;
-        goto done;
-
-    }
-
-    if ((Ccb->OtherSide == NULL) && (Ccb->ReadDataAvailable == 0))
-    {
-        if (Ccb->PipeState == FILE_PIPE_CONNECTED_STATE)
-            Status = STATUS_PIPE_BROKEN;
-        else if (Ccb->PipeState == FILE_PIPE_LISTENING_STATE)
-            Status = STATUS_PIPE_LISTENING;
-        else if (Ccb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
-            Status = STATUS_PIPE_DISCONNECTED;
-        else
-            Status = STATUS_UNSUCCESSFUL;
-        Irp->IoStatus.Information = 0;
-        goto done;
-    }
-
-    if (Ccb->Data == NULL)
-    {
-        DPRINT("Pipe is NOT readable!\n");
-        Status = STATUS_UNSUCCESSFUL;
-        Irp->IoStatus.Information = 0;
-        goto done;
-    }
-
-    ExAcquireFastMutex(&Ccb->DataListLock);
-
-    if (IoIsOperationSynchronous(Irp))
-    {
-        InsertTailList(&Ccb->ReadRequestListHead, &Context->ListEntry);
-        if (Ccb->ReadRequestListHead.Flink != &Context->ListEntry)
-        {
-            KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
-            Context->WaitEvent = &Event;
-            ExReleaseFastMutex(&Ccb->DataListLock);
-            KeWaitForSingleObject(&Event,
-                Executive,
-                KernelMode,
-                FALSE,
-                NULL);
-            ExAcquireFastMutex(&Ccb->DataListLock);
-        }
-        Irp->IoStatus.Information = 0;
-    }
-    else
-    {
-        KIRQL oldIrql;
-        if (IsListEmpty(&Ccb->ReadRequestListHead) ||
-            Ccb->ReadRequestListHead.Flink != &Context->ListEntry)
-        {
-            /* this is a new request */
-            Irp->IoStatus.Information = 0;
-            KeResetEvent(&Ccb->ReadEvent);
-            Context->WaitEvent = &Ccb->ReadEvent;
-            InsertTailList(&Ccb->ReadRequestListHead, &Context->ListEntry);
-            if (Ccb->ReadRequestListHead.Flink != &Context->ListEntry)
-            {
-                /* there was already a request on the list */
-                IoAcquireCancelSpinLock(&oldIrql);
-                if (Irp->Cancel)
-                {
-                    IoReleaseCancelSpinLock(oldIrql);
-                    RemoveEntryList(&Context->ListEntry);
-                    ExReleaseFastMutex(&Ccb->DataListLock);
-                    Status = STATUS_CANCELLED;
-                    goto done;
-                }
-                (void)IoSetCancelRoutine(Irp, NpfsReadWriteCancelRoutine);
-                IoReleaseCancelSpinLock(oldIrql);
-                ExReleaseFastMutex(&Ccb->DataListLock);
-                IoMarkIrpPending(Irp);
-                Status = STATUS_PENDING;
-                goto done;
-            }
-        }
-    }
-
-    while (1)
-    {
-        Buffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress,
-                                              NormalPagePriority);
-        Information = Irp->IoStatus.Information;
-        Length = IoGetCurrentIrpStackLocation(Irp)->Parameters.Read.Length;
-        ASSERT(Information <= Length);
-        Buffer = (PVOID)((ULONG_PTR)Buffer + Information);
-        Length -= Information;
-        Status = STATUS_SUCCESS;
-
-        while (1)
-        {
-            if (Ccb->ReadDataAvailable == 0)
-            {
-                ULONG ConnectionSideReadMode;
-
-                if (Ccb->PipeEnd == FILE_PIPE_CLIENT_END) ConnectionSideReadMode=Ccb->Fcb->ClientReadMode;
-                else ConnectionSideReadMode = Ccb->Fcb->ServerReadMode;
-
-                if ((Ccb->PipeState == FILE_PIPE_CONNECTED_STATE) && (Ccb->OtherSide))
-                {
-                    KeSetEvent(&Ccb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE);
-                }
-                if (Information > 0 &&
-                    (ConnectionSideReadMode != FILE_PIPE_BYTE_STREAM_MODE ||
-                    Ccb->PipeState != FILE_PIPE_CONNECTED_STATE))
-                {
-                    break;
-                }
-                ASSERT(Ccb->ReadDataAvailable == 0);
-                if ((Ccb->PipeState != FILE_PIPE_CONNECTED_STATE) || (!Ccb->OtherSide))
-                {
-                    DPRINT("PipeState: %x\n", Ccb->PipeState);
-                    Status = STATUS_PIPE_BROKEN;
-                    break;
-                }
-                KeResetEvent(&Ccb->ReadEvent);
-                ExReleaseFastMutex(&Ccb->DataListLock);
-
-                if (IoIsOperationSynchronous(Irp))
-                {
-                    /* Wait for ReadEvent to become signaled */
-
-                    DPRINT("Waiting for readable data (%wZ)\n", &Ccb->Fcb->PipeName);
-                    Status = KeWaitForSingleObject(&Ccb->ReadEvent,
-                        UserRequest,
-                        Irp->RequestorMode,
-                        (FileObject->Flags & FO_ALERTABLE_IO) != 0,
-                        NULL);
-                    DPRINT("Finished waiting (%wZ)! Status: %lx\n", &Ccb->Fcb->PipeName, Status);
-
-                    ExAcquireFastMutex(&Ccb->DataListLock);
-
-                    if ((Status == STATUS_USER_APC) || (Status == STATUS_KERNEL_APC) || (Status == STATUS_ALERTED))
-                    {
-                        Status = STATUS_CANCELLED;
-                        break;
-                    }
-                    if (!NT_SUCCESS(Status))
-                    {
-                        ASSERT(FALSE);
-                    }
-                }
-                else
-                {
-                    Context = (PNPFS_CONTEXT)&Irp->Tail.Overlay.DriverContext;
-
-                    Context->WaitEvent = &Ccb->ReadEvent;
-                    Status = NpfsAddWaitingReadWriteRequest(DeviceObject, Irp);
-
-                    if (NT_SUCCESS(Status))
-                    {
-                        Status = STATUS_PENDING;
-                        goto done;
-                    }
-                    ExAcquireFastMutex(&Ccb->DataListLock);
-                    break;
-                }
-            }
-            ASSERT(IoGetCurrentIrpStackLocation(Irp)->FileObject != NULL);
-
-            /* If the pipe type and read mode are both byte stream */
-            if (Ccb->Fcb->PipeType == FILE_PIPE_BYTE_STREAM_TYPE)
-            {
-                DPRINT("Byte stream mode: Ccb->Data %p\n", Ccb->Data);
-                /* Byte stream mode */
-                while (Length > 0 && Ccb->ReadDataAvailable > 0)
-                {
-                    CopyLength = min(Ccb->ReadDataAvailable, Length);
-                    if ((ULONG_PTR)Ccb->ReadPtr + CopyLength <= (ULONG_PTR)Ccb->Data + Ccb->MaxDataLength)
-                    {
-                        memcpy(Buffer, Ccb->ReadPtr, CopyLength);
-                        Ccb->ReadPtr = (PVOID)((ULONG_PTR)Ccb->ReadPtr + CopyLength);
-                        if (Ccb->ReadPtr == (PVOID)((ULONG_PTR)Ccb->Data + Ccb->MaxDataLength))
-                        {
-                            Ccb->ReadPtr = Ccb->Data;
-                        }
-                    }
-                    else
-                    {
-                        TempLength = (ULONG)((ULONG_PTR)Ccb->Data + Ccb->MaxDataLength - (ULONG_PTR)Ccb->ReadPtr);
-                        memcpy(Buffer, Ccb->ReadPtr, TempLength);
-                        memcpy((PVOID)((ULONG_PTR)Buffer + TempLength), Ccb->Data, CopyLength - TempLength);
-                        Ccb->ReadPtr = (PVOID)((ULONG_PTR)Ccb->Data + CopyLength - TempLength);
-                    }
-
-                    Buffer = (PVOID)((ULONG_PTR)Buffer + CopyLength);
-                    Length -= CopyLength;
-                    Information += CopyLength;
-
-                    Ccb->ReadDataAvailable -= CopyLength;
-                    Ccb->WriteQuotaAvailable += CopyLength;
-                }
-
-                if ((Length == 0) || (Ccb->ReadDataAvailable == 0))
-                {
-                    if ((Ccb->PipeState == FILE_PIPE_CONNECTED_STATE) && (Ccb->OtherSide))
-                    {
-                        KeSetEvent(&Ccb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE);
-                    }
-                    break;
-                }
-            }
-            else if (Ccb->Fcb->PipeType == FILE_PIPE_MESSAGE_TYPE)
-            {
-                DPRINT("Message mode: Ccb>Data %p\n", Ccb->Data);
-
-                /* Check if buffer is full and the read pointer is not at the start of the buffer */
-                if ((Ccb->WriteQuotaAvailable == 0) && (Ccb->ReadPtr > Ccb->Data))
-                {
-                    Ccb->WriteQuotaAvailable += (ULONG_PTR)Ccb->ReadPtr - (ULONG_PTR)Ccb->Data;
-                    memcpy(Ccb->Data, Ccb->ReadPtr, (ULONG_PTR)Ccb->WritePtr - (ULONG_PTR)Ccb->ReadPtr);
-                    Ccb->WritePtr = (PVOID)((ULONG_PTR)Ccb->WritePtr - ((ULONG_PTR)Ccb->ReadPtr - (ULONG_PTR)Ccb->Data));
-                    Ccb->ReadPtr = Ccb->Data;
-                    ASSERT((ULONG_PTR)Ccb->WritePtr < ((ULONG_PTR)Ccb->Data + Ccb->MaxDataLength));
-                    ASSERT(Ccb->WritePtr >= Ccb->Data);
-                }
-
-                /* For Message mode, the Message length is stored in the buffer preceeding the Message. */
-                if (Ccb->ReadDataAvailable)
-                {
-                    ULONG NextMessageLength = 0;
-
-                    /* First get the size of the message */
-                    memcpy(&NextMessageLength, Ccb->ReadPtr, sizeof(NextMessageLength));
-
-                    if ((NextMessageLength == 0) || (NextMessageLength > Ccb->ReadDataAvailable))
-                    {
-                        DPRINT1("Possible memory corruption.\n");
-                        HexDump(Ccb->Data, (ULONG_PTR)Ccb->WritePtr - (ULONG_PTR)Ccb->Data);
-                        ASSERT(FALSE);
-                    }
-
-                    /* Use the smaller value */
-                    CopyLength = min(NextMessageLength, Length);
-                    ASSERT(CopyLength > 0);
-                    ASSERT(CopyLength <= Ccb->ReadDataAvailable);
-                    /* retrieve the message from the buffer */
-                    memcpy(Buffer, (PVOID)((ULONG_PTR)Ccb->ReadPtr + sizeof(NextMessageLength)), CopyLength);
-
-                    if (Ccb->ReadDataAvailable > CopyLength)
-                    {
-                        if (CopyLength < NextMessageLength)
-                        /* Client only requested part of the message */
-                        {
-                            /* Calculate the remaining message new size */
-                            ULONG NewMessageSize = NextMessageLength - CopyLength;
-
-                            /* Update ReadPtr to point to new Message size location */
-                            Ccb->ReadPtr = (PVOID)((ULONG_PTR)Ccb->ReadPtr + CopyLength);
-
-                            /* Write a new Message size to buffer for the part of the message still there */
-                            memcpy(Ccb->ReadPtr, &NewMessageSize, sizeof(NewMessageSize));
-                        }
-                        else
-                        /* Client wanted the entire message */
-                        {
-                            /* Update ReadPtr to point to next message size */
-                            Ccb->ReadPtr = (PVOID)((ULONG_PTR)Ccb->ReadPtr + CopyLength + sizeof(CopyLength));
-                        }
-                    }
-                    else
-                    {
-                        /* This was the last Message, so just zero start of buffer for safety sake */
-                        memset(Ccb->Data, 0, NextMessageLength + sizeof(NextMessageLength));
-
-                        /* Reset to MaxDataLength as partial message retrievals dont
-                           give the length back to Quota */
-                        Ccb->WriteQuotaAvailable = Ccb->MaxDataLength;
-
-                        /* reset read and write pointer to beginning of buffer */
-                        Ccb->WritePtr = Ccb->Data;
-                        Ccb->ReadPtr = Ccb->Data;
-                    }
-#ifndef NDEBUG
-                    DPRINT("Length %d Buffer %x\n", CopyLength, Buffer);
-                    HexDump((PUCHAR)Buffer, CopyLength);
-#endif
-
-                    Information += CopyLength;
-
-                    Ccb->ReadDataAvailable -= CopyLength;
-
-                    ASSERT(Ccb->WriteQuotaAvailable <= Ccb->MaxDataLength);
-                }
-
-                if (Information > 0)
-                {
-                    ULONG ConnectionSideReadMode;
-
-                    if (Ccb->PipeEnd == FILE_PIPE_CLIENT_END) ConnectionSideReadMode=Ccb->Fcb->ClientReadMode;
-                    else ConnectionSideReadMode = Ccb->Fcb->ServerReadMode;
-
-                    if ((ConnectionSideReadMode == FILE_PIPE_BYTE_STREAM_MODE) && (Ccb->ReadDataAvailable) && (Length > CopyLength))
-                    {
-                        Buffer = (PVOID)((ULONG_PTR)Buffer + CopyLength);
-                        Length -= CopyLength;
-                    }
-                    else
-                    {
-                        if ((Ccb->PipeState == FILE_PIPE_CONNECTED_STATE) && (Ccb->WriteQuotaAvailable > 0) && (Ccb->OtherSide))
-                        {
-                            KeSetEvent(&Ccb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE);
-                        }
-                        break;
-                    }
-                }
-            }
-            else
-            {
-                DPRINT1("Unhandled Pipe Mode!\n");
-                ASSERT(FALSE);
-            }
-        }
-        Irp->IoStatus.Information = Information;
-        Irp->IoStatus.Status = Status;
-
-        ASSERT(IoGetCurrentIrpStackLocation(Irp)->FileObject != NULL);
-
-        if (IoIsOperationSynchronous(Irp))
-        {
-            RemoveEntryList(&Context->ListEntry);
-            if (!IsListEmpty(&Ccb->ReadRequestListHead))
-            {
-                Context = CONTAINING_RECORD(Ccb->ReadRequestListHead.Flink, NPFS_CONTEXT, ListEntry);
-                KeSetEvent(Context->WaitEvent, IO_NO_INCREMENT, FALSE);
-            }
-            ExReleaseFastMutex(&Ccb->DataListLock);
-            IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
-            DPRINT("NpfsRead done (Status %lx)\n", Status);
-            return Status;
-        }
-        else
-        {
-            KIRQL oldIrql;
-
-            if (IsOriginalRequest)
-            {
-                IsOriginalRequest = FALSE;
-                OriginalStatus = Status;
-            }
-            if (Status == STATUS_PENDING)
-            {
-                ExReleaseFastMutex(&Ccb->DataListLock);
-                DPRINT("NpfsRead done (Status %lx)\n", OriginalStatus);
-                return OriginalStatus;
-            }
-            RemoveEntryList(&Context->ListEntry);
-            IoCompleteRequest(Irp, IO_NO_INCREMENT);
-            if (IsListEmpty(&Ccb->ReadRequestListHead))
-            {
-                ExReleaseFastMutex(&Ccb->DataListLock);
-                DPRINT("NpfsRead done (Status %lx)\n", OriginalStatus);
-                return OriginalStatus;
-            }
-
-            IoAcquireCancelSpinLock(&oldIrql);
-            Context = CONTAINING_RECORD(Ccb->ReadRequestListHead.Flink, NPFS_CONTEXT, ListEntry);
-
-            Irp = CONTAINING_RECORD(Context, IRP, Tail.Overlay.DriverContext);
-            /* Verify the Irp wasnt cancelled */
-            if (Irp->Cancel)
-            {
-                IoReleaseCancelSpinLock(oldIrql);
-                RemoveEntryList(&Context->ListEntry);
-                ExReleaseFastMutex(&Ccb->DataListLock);
-                Status = STATUS_CANCELLED;
-                goto done;
-            }
-            /* The Irp will now be handled, so remove the CancelRoutine */
-            (void)IoSetCancelRoutine(Irp, NULL);
-            IoReleaseCancelSpinLock(oldIrql);
-        }
-    }
-
-done:
-    Irp->IoStatus.Status = Status;
-
-    if (Status != STATUS_PENDING)
-    {
-        IoCompleteRequest(Irp, IO_NO_INCREMENT);
-    }
-    DPRINT("NpfsRead done (Status %lx)\n", Status);
-
-    return Status;
-}
-
-NTSTATUS NTAPI
-NpfsWrite(PDEVICE_OBJECT DeviceObject,
-          PIRP Irp)
-{
-    PIO_STACK_LOCATION IoStack;
-    PFILE_OBJECT FileObject;
-    PNPFS_FCB Fcb = NULL;
-    PNPFS_CCB Ccb = NULL;
-    PNPFS_CCB ReaderCcb;
-    PUCHAR Buffer;
-    NTSTATUS Status = STATUS_SUCCESS;
-    ULONG Length;
-    ULONG Offset;
-    ULONG Information = 0;
-    ULONG CopyLength;
-    ULONG TempLength;
-
-    UNREFERENCED_PARAMETER(DeviceObject);
-
-    DPRINT("NpfsWrite()\n");
-
-    IoStack = IoGetCurrentIrpStackLocation(Irp);
-    FileObject = IoStack->FileObject;
-    DPRINT("FileObject %p\n", FileObject);
-    DPRINT("Pipe name %wZ\n", &FileObject->FileName);
-
-    Ccb = FileObject->FsContext2;
-
-    /* Fail, if the CCB is not a pipe CCB */
-    if (Ccb->Type != CCB_PIPE)
-    {
-        DPRINT("Not a pipe!\n");
-        Status = STATUS_INVALID_PARAMETER;
-        Length = 0;
-        goto done;
-    }
-
-    ReaderCcb = Ccb->OtherSide;
-    Fcb = Ccb->Fcb;
-
-    Length = IoStack->Parameters.Write.Length;
-    Offset = IoStack->Parameters.Write.ByteOffset.u.LowPart;
-
-    if (Irp->MdlAddress == NULL)
-    {
-        DPRINT("Irp->MdlAddress == NULL\n");
-        Status = STATUS_UNSUCCESSFUL;
-        Length = 0;
-        goto done;
-    }
-
-    if ((ReaderCcb == NULL) || (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE))
-    {
-        DPRINT("Pipe is NOT connected!\n");
-        if (Ccb->PipeState == FILE_PIPE_LISTENING_STATE)
-            Status = STATUS_PIPE_LISTENING;
-        else if (Ccb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
-            Status = STATUS_PIPE_DISCONNECTED;
-        else
-            Status = STATUS_UNSUCCESSFUL;
-        Length = 0;
-        goto done;
-    }
-
-    if (ReaderCcb->Data == NULL)
-    {
-        DPRINT("Pipe is NOT writable!\n");
-        Status = STATUS_UNSUCCESSFUL;
-        Length = 0;
-        goto done;
-    }
-
-    Status = STATUS_SUCCESS;
-    Buffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority);
-
-    if (!Buffer)
-    {
-        DPRINT("MmGetSystemAddressForMdlSafe failed\n");
-        Status = STATUS_INSUFFICIENT_RESOURCES;
-        Length = 0;
-        goto done;
-
-    }
-
-    ExAcquireFastMutex(&ReaderCcb->DataListLock);
-
-    DPRINT("Length %lu Buffer %p Offset %lu\n", Length, Buffer, Offset);
-
-#ifndef NDEBUG
-    HexDump(Buffer, Length);
-#endif
-
-    while (1)
-    {
-        if (ReaderCcb->WriteQuotaAvailable == 0)
-        {
-            if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE || !Ccb->OtherSide)
-            {
-                Status = STATUS_PIPE_BROKEN;
-                ExReleaseFastMutex(&ReaderCcb->DataListLock);
-                goto done;
-            }
-            KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE);
-            KeResetEvent(&Ccb->WriteEvent);
-            ExReleaseFastMutex(&ReaderCcb->DataListLock);
-
-            DPRINT("Write Waiting for buffer space (%wZ)\n", &Fcb->PipeName);
-            Status = KeWaitForSingleObject(&Ccb->WriteEvent,
-                UserRequest,
-                Irp->RequestorMode,
-                (FileObject->Flags & FO_ALERTABLE_IO) != 0,
-                NULL);
-            DPRINT("Write Finished waiting (%wZ)! Status: %lx\n", &Fcb->PipeName, Status);
-
-            if ((Status == STATUS_USER_APC) || (Status == STATUS_KERNEL_APC) || (Status == STATUS_ALERTED))
-            {
-                Status = STATUS_CANCELLED;
-                goto done;
-            }
-            if (!NT_SUCCESS(Status))
-            {
-                ASSERT(FALSE);
-            }
-            /*
-            * It's possible that the event was signaled because the
-            * other side of pipe was closed.
-            */
-            if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE || !Ccb->OtherSide)
-            {
-                DPRINT("PipeState: %lx\n", Ccb->PipeState);
-                Status = STATUS_PIPE_BROKEN;
-                goto done;
-            }
-            /* Check that the pipe has not been closed */
-            if (ReaderCcb->PipeState != FILE_PIPE_CONNECTED_STATE || !ReaderCcb->OtherSide)
-            {
-                Status = STATUS_PIPE_BROKEN;
-                goto done;
-            }
-            ExAcquireFastMutex(&ReaderCcb->DataListLock);
-        }
-
-        if (Ccb->Fcb->PipeType == FILE_PIPE_BYTE_STREAM_TYPE)
-        {
-            DPRINT("Byte stream mode: Ccb->Data %p, Ccb->WritePtr %p\n", ReaderCcb->Data, ReaderCcb->WritePtr);
-
-            while (Length > 0 && ReaderCcb->WriteQuotaAvailable > 0)
-            {
-                CopyLength = min(Length, ReaderCcb->WriteQuotaAvailable);
-
-                if ((ULONG_PTR)ReaderCcb->WritePtr + CopyLength <= (ULONG_PTR)ReaderCcb->Data + ReaderCcb->MaxDataLength)
-                {
-                    memcpy(ReaderCcb->WritePtr, Buffer, CopyLength);
-                    ReaderCcb->WritePtr = (PVOID)((ULONG_PTR)ReaderCcb->WritePtr + CopyLength);
-                    if ((ULONG_PTR)ReaderCcb->WritePtr == (ULONG_PTR)ReaderCcb->Data + ReaderCcb->MaxDataLength)
-                    {
-                        ReaderCcb->WritePtr = ReaderCcb->Data;
-                    }
-                }
-                else
-                {
-
-                    TempLength = (ULONG)((ULONG_PTR)ReaderCcb->Data + ReaderCcb->MaxDataLength -
-                            (ULONG_PTR)ReaderCcb->WritePtr);
-
-                    memcpy(ReaderCcb->WritePtr, Buffer, TempLength);
-                    memcpy(ReaderCcb->Data, Buffer + TempLength, CopyLength - TempLength);
-                    ReaderCcb->WritePtr = (PVOID)((ULONG_PTR)ReaderCcb->Data + CopyLength - TempLength);
-                }
-
-                Buffer += CopyLength;
-                Length -= CopyLength;
-                Information += CopyLength;
-
-                ReaderCcb->ReadDataAvailable += CopyLength;
-                ReaderCcb->WriteQuotaAvailable -= CopyLength;
-            }
-
-            if (Length == 0)
-            {
-                KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE);
-                break;
-            }
-        }
-        else if (Ccb->Fcb->PipeType == FILE_PIPE_MESSAGE_TYPE)
-        {
-            /* For Message Type Pipe, the Pipes memory will be used to store the size of each message */
-            DPRINT("Message mode: Ccb->Data %p, Ccb->WritePtr %p\n", ReaderCcb->Data, ReaderCcb->WritePtr);
-            if (Length > 0)
-            {
-                /* Verify the WritePtr is still inside the buffer */
-                if (((ULONG_PTR)ReaderCcb->WritePtr > ((ULONG_PTR)ReaderCcb->Data + (ULONG_PTR)ReaderCcb->MaxDataLength)) ||
-                ((ULONG_PTR)ReaderCcb->WritePtr < (ULONG_PTR)ReaderCcb->Data))
-                {
-                    DPRINT1("NPFS is writing out of its buffer. Report to developer!\n");
-                    DPRINT1("ReaderCcb->WritePtr %p, ReaderCcb->Data %p, ReaderCcb->MaxDataLength %lu\n",
-                        ReaderCcb->WritePtr, ReaderCcb->Data, ReaderCcb->MaxDataLength);
-                    ASSERT(FALSE);
-                }
-
-                CopyLength = min(Length, ReaderCcb->WriteQuotaAvailable - sizeof(ULONG));
-                if (CopyLength > ReaderCcb->WriteQuotaAvailable)
-                {
-                    DPRINT1("Writing %lu byte to pipe would overflow as only %lu bytes are available\n",
-                        CopyLength, ReaderCcb->WriteQuotaAvailable);
-                    ASSERT(FALSE);
-                }
-
-                /* First Copy the Length of the message into the pipes buffer */
-                memcpy(ReaderCcb->WritePtr, &CopyLength, sizeof(CopyLength));
-
-                /* Now the user buffer itself */
-                memcpy((PVOID)((ULONG_PTR)ReaderCcb->WritePtr + sizeof(CopyLength)), Buffer, CopyLength);
-
-                /* Update the write pointer */
-                ReaderCcb->WritePtr = (PVOID)((ULONG_PTR)ReaderCcb->WritePtr + sizeof(CopyLength) + CopyLength);
-
-                Information += CopyLength;
-
-                ReaderCcb->ReadDataAvailable += CopyLength;
-
-                ReaderCcb->WriteQuotaAvailable -= (CopyLength + sizeof(ULONG));
-
-                if ((ULONG_PTR)ReaderCcb->WriteQuotaAvailable > (ULONG)ReaderCcb->MaxDataLength)
-                {
-                    DPRINT1("QuotaAvailable is greater than buffer size!\n");
-                    ASSERT(FALSE);
-                }
-            }
-
-            if (Information > 0)
-            {
-                KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE);
-                break;
-            }
-        }
-        else
-        {
-            DPRINT1("Unhandled Pipe Type Mode and Read Write Mode!\n");
-            ASSERT(FALSE);
-        }
-    }
-
-    ExReleaseFastMutex(&ReaderCcb->DataListLock);
-
-done:
-    Irp->IoStatus.Status = Status;
-    Irp->IoStatus.Information = Information;
-
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
-    DPRINT("NpfsWrite done (Status %lx)\n", Status);
-
-    return Status;
-}
-
-/* EOF */
diff --git a/drivers/filesystems/npfs/volume.c b/drivers/filesystems/npfs/volume.c
deleted file mode 100644 (file)
index b90cba4..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
-* COPYRIGHT:        See COPYING in the top level directory
-* PROJECT:          ReactOS kernel
-* FILE:             drivers/filesystems/npfs/volume.c
-* PURPOSE:          Named pipe filesystem
-* PROGRAMMER:       Eric Kohl
-*/
-
-/* INCLUDES *****************************************************************/
-
-#include "npfs.h"
-
-#define NDEBUG
-#include <debug.h>
-
-/* FUNCTIONS ****************************************************************/
-
-NTSTATUS
-NTAPI
-NpQueryFsDeviceInformation(IN PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,
-                           OUT PULONG BufferLength)
-{
-    PAGED_CODE();
-    DPRINT("NpfsQueryFsDeviceInformation()\n");
-    DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo);
-
-    if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
-    {
-        return STATUS_BUFFER_OVERFLOW;
-    }
-
-    FsDeviceInfo->DeviceType = FILE_DEVICE_NAMED_PIPE;
-    FsDeviceInfo->Characteristics = 0;
-
-    *BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
-
-    DPRINT("NpfsQueryFsDeviceInformation() finished.\n");
-
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS
-NTAPI
-NpQueryFsFullSizeInfo(IN PFILE_FS_FULL_SIZE_INFORMATION FsSizeInfo,
-                      OUT PULONG BufferSize)
-{
-    RtlZeroMemory(FsSizeInfo, sizeof(FILE_FS_FULL_SIZE_INFORMATION));
-    *BufferSize -= sizeof(FILE_FS_FULL_SIZE_INFORMATION);
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS
-NTAPI
-NpQueryFsSizeInfo(IN PFILE_FS_SIZE_INFORMATION FsSizeInfo,
-                  OUT PULONG BufferSize)
-{
-    FsSizeInfo->TotalAllocationUnits.LowPart = 0;
-    FsSizeInfo->TotalAllocationUnits.HighPart = 0;
-    FsSizeInfo->AvailableAllocationUnits.LowPart = 0;
-    FsSizeInfo->AvailableAllocationUnits.HighPart = 0;
-    FsSizeInfo->SectorsPerAllocationUnit = 1;
-    FsSizeInfo->BytesPerSector = 1;
-    *BufferSize -= sizeof(FILE_FS_SIZE_INFORMATION);
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS
-NTAPI
-NpQueryFsAttributeInformation(IN PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo,
-                              OUT PULONG BufferLength)
-{
-    PAGED_CODE();
-    DPRINT("NpfsQueryFsAttributeInformation() called.\n");
-    DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo);
-
-    if (*BufferLength < sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8)
-    {
-        *BufferLength = 0;
-        return STATUS_BUFFER_OVERFLOW;
-    }
-
-    FsAttributeInfo->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES;
-    FsAttributeInfo->MaximumComponentNameLength = -1;
-    FsAttributeInfo->FileSystemNameLength = 8;
-    wcscpy(FsAttributeInfo->FileSystemName, L"NPFS");
-
-    DPRINT("NpfsQueryFsAttributeInformation() finished.\n");
-    *BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
-
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS
-NTAPI
-NpCommonQueryVolumeInformation(IN PIRP Irp)
-{
-    PIO_STACK_LOCATION Stack;
-    FS_INFORMATION_CLASS FsInformationClass;
-    PVOID SystemBuffer;
-    ULONG BufferLength;
-    NTSTATUS Status;
-    PAGED_CODE();
-
-    Stack = IoGetCurrentIrpStackLocation(Irp);
-    FsInformationClass = Stack->Parameters.QueryVolume.FsInformationClass;
-    BufferLength = Stack->Parameters.QueryVolume.Length;
-    SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
-
-    DPRINT("FsInformationClass %d\n", FsInformationClass);
-    DPRINT("SystemBuffer %p\n", SystemBuffer);
-
-    switch (FsInformationClass)
-    {
-    case FileFsFullSizeInformation:
-        Status = NpQueryFsFullSizeInfo(SystemBuffer, &BufferLength);
-        break;
-    case FileFsSizeInformation:
-        Status = NpQueryFsSizeInfo(SystemBuffer, &BufferLength);
-        break;
-
-    case FileFsDeviceInformation:
-        Status = NpQueryFsDeviceInformation(SystemBuffer, &BufferLength);
-        break;
-
-    case FileFsAttributeInformation:
-        Status = NpQueryFsAttributeInformation(SystemBuffer, &BufferLength);
-        break;
-
-    default:
-        DPRINT1("Query not implemented: %d\n", FsInformationClass);
-        Status = STATUS_NOT_SUPPORTED;
-    }
-
-    Irp->IoStatus.Information = Stack->Parameters.QueryVolume.Length - BufferLength;
-    return Status;
-}
-
-NTSTATUS
-NTAPI
-NpfsQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject,
-                           IN PIRP Irp)
-{
-    NTSTATUS Status;
-    PAGED_CODE();
-    DPRINT("NpfsQueryVolumeInformation(DeviceObject %p, Irp %p)\n", DeviceObject, Irp);
-
-    FsRtlEnterFileSystem();
-    Status = NpCommonQueryVolumeInformation(Irp);
-    FsRtlExitFileSystem();
-
-    if (Status != STATUS_PENDING)
-    {
-        Irp->IoStatus.Status = Status;
-
-        IoCompleteRequest(Irp, IO_DISK_INCREMENT);
-    }
-
-    return Status;
-}
-
-/* EOF */
diff --git a/drivers/multimedia/portcls.NEW/adapter.c b/drivers/multimedia/portcls.NEW/adapter.c
deleted file mode 100644 (file)
index 5a96bd0..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-    ReactOS Kernel Streaming
-    Port Class API: Adapter initialization
-
-    Author: Andrew Greenwood
-
-*/
-
-#include <portcls.h>
-
-
-NTSTATUS
-PcStartIo(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PIRP Irp)
-{
-    /* Internal function */
-    return STATUS_UNSUCCESSFUL;
-}
-
-NTSTATUS
-PcUnload(
-    IN  PDRIVER_OBJECT DriverObject)
-{
-    /* Internal function */
-    return STATUS_UNSUCCESSFUL;
-}
-
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcInitializeAdapterDriver(
-    IN  PDRIVER_OBJECT DriverObject,
-    IN  PUNICODE_STRING RegistryPathName,
-    IN  PDRIVER_ADD_DEVICE AddDevice)
-{
-    /*
-        This is effectively a common DriverEntry function for PortCls drivers.
-        So it has similar responsibilities to a normal driver.
-
-        First 2 parameters are from DriverEntry.
-        Installs the supplied AddDevice routine in the driver object?s driver extension and installs the PortCls driver?s IRP handlers in the driver object itself.
-    */
-
-    DriverObject->DriverExtension->AddDevice = AddDevice;
-
-    /*
-        TODO: (* = implement here, otherwise KS default)
-        IRP_MJ_CLOSE
-        * IRP_MJ_CREATE
-        IRP_MJ_DEVICE_CONTROL
-        IRP_MJ_FLUSH_BUFFERS
-        * IRP_MJ_PNP
-        * IRP_MJ_POWER
-        IRP_MJ_QUERY_SECURITY
-        IRP_MJ_READ
-        IRP_MJ_SET_SECURITY
-        * IRP_MJ_SYSTEM_CONTROL
-        IRP_MJ_WRITE
-    */
-
-    UNIMPLEMENTED;
-
-    return STATUS_SUCCESS;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcAddAdapterDevice(
-    IN  PDRIVER_OBJECT DriverObject,
-    IN  PDEVICE_OBJECT PhysicalDeviceObject,
-    IN  PCPFNSTARTDEVICE StartDevice,
-    IN  ULONG MaxObjects,
-    IN  ULONG DeviceExtensionSize)
-{
-    /*
-        Note - after this has been called, we can
-        handle IRP_MN_START_DEVICE by calling StartDevice
-    */
-
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
diff --git a/drivers/multimedia/portcls.NEW/dll.c b/drivers/multimedia/portcls.NEW/dll.c
deleted file mode 100644 (file)
index 5d60253..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-    ReactOS Kernel Streaming
-    Port Class / Library Init and Cleanup
-
-    Author: Andrew Greenwood
-
-    Notes:
-    -
-*/
-
-#include <ntddk.h>
-
-/*
- * @implemented
- */
-ULONG STDCALL
-DllInitialize(ULONG Unknown)
-{
-    return 0;
-}
-
-/*
- * @implemented
- */
-ULONG STDCALL
-DllUnload(VOID)
-{
-    return 0;
-}
diff --git a/drivers/multimedia/portcls.NEW/drm.c b/drivers/multimedia/portcls.NEW/drm.c
deleted file mode 100644 (file)
index 3aae56d..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-    ReactOS Kernel Streaming
-    Port Class / Digital Rights Management
-
-    Author: Andrew Greenwood
-
-    Notes:
-        These are convenience functions for accessing DRM facilities, as
-        documented here:
-        http://www.osronline.com/ddkx/stream/aud-prop_9f77.htm
-*/
-
-#include <portcls.h>
-#include <drmk.h>
-
-PORTCLASSAPI NTSTATUS NTAPI
-PcAddContentHandlers(
-    IN  ULONG ContentId,
-    IN  PVOID *paHandlers,
-    IN  ULONG NumHandlers)
-{
-    return DrmAddContentHandlers(ContentId, paHandlers, NumHandlers);
-}
-
-PORTCLASSAPI NTSTATUS NTAPI
-PcCreateContentMixed(
-    IN  PULONG paContentId,
-    IN  ULONG cContentId,
-    OUT PULONG pMixedContentId)
-{
-    return DrmCreateContentMixed(paContentId, cContentId, pMixedContentId);
-}
-
-PORTCLASSAPI NTSTATUS NTAPI
-PcDestroyContent(
-    IN  ULONG ContentId)
-{
-    return DrmDestroyContent(ContentId);
-}
-
-PORTCLASSAPI NTSTATUS NTAPI
-PcForwardContentToDeviceObject(
-    IN  ULONG ContentId,
-    IN  PVOID Reserved,
-    IN  PCDRMFORWARD DrmForward)
-{
-    return DrmForwardContentToDeviceObject(ContentId, Reserved, DrmForward);
-}
-
-PORTCLASSAPI NTSTATUS NTAPI
-PcForwardContentToFileObject(
-    IN  ULONG ContentId,
-    IN  PFILE_OBJECT FileObject)
-{
-    return DrmForwardContentToFileObject(ContentId, FileObject);
-}
-
-PORTCLASSAPI NTSTATUS NTAPI
-PcForwardContentToInterface(
-    IN  ULONG ContentId,
-    IN  PUNKNOWN pUnknown,
-    IN  ULONG NumMethods)
-{
-    return DrmForwardContentToInterface(ContentId, pUnknown, NumMethods);
-}
-
-PORTCLASSAPI NTSTATUS NTAPI
-PcGetContentRights(
-    IN  ULONG ContentId,
-    OUT PDRMRIGHTS DrmRights)
-{
-    return DrmGetContentRights(ContentId, DrmRights);
-}
diff --git a/drivers/multimedia/portcls.NEW/portcls.c b/drivers/multimedia/portcls.NEW/portcls.c
deleted file mode 100644 (file)
index 68fc51f..0000000
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- * PROJECT:     ReactOS Sound System
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        drivers/multimedia/portcls/portcls.c
- * PURPOSE:     Audio Port Class Functions
- * PROGRAMMERS: 
- *
- */
-
-#include "portcls.h"
-
-
-#define NDEBUG
-#include <debug.h>
-
-
-NTSTATUS STDCALL
-DriverEntry(PDRIVER_OBJECT DriverObject,
-            PUNICODE_STRING RegistryPath)
-{
-    return STATUS_SUCCESS;
-}
-
-/*
- * @implemented
- */
-ULONG STDCALL
-DllInitialize(ULONG Unknown)
-{
-    return 0;
-}
-
-/*
- * @implemented
- */
-ULONG STDCALL
-DllUnload(VOID)
-{
-    return 0;
-}
-
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcAddAdapterDevice(
- ULONG DriverObject,
- ULONG PhysicalDeviceObject,
- ULONG StartDevice,
- ULONG MaxObjects,
- ULONG DeviceExtensionSize
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcAddContentHandlers(
- ULONG  ContentId,
- ULONG  paHandlers,
- ULONG  NumHandlers
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcCompleteIrp(
- ULONG  DeviceObject,
- ULONG  Irp,
- ULONG  Status
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcCompletePendingPropertyRequest(
- ULONG PropertyRequest,
- ULONG NtStatus
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL 
-PcCreateContentMixed(
- ULONG paContentId,
- ULONG cContentId,
- ULONG pMixedContentId
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcDestroyContent(
- ULONG ContentId
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcDispatchIrp(
- ULONG DeviceObject,
- ULONG Irp
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcForwardContentToDeviceObject(
- ULONG ContentId,
- ULONG Reserved,
- ULONG DrmForward
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL 
-PcForwardContentToFileObject(
- ULONG ContentId,
- ULONG FileObject
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL 
-PcForwardContentToInterface(
- ULONG ContentId,
- ULONG Unknown,
- ULONG NumMethods
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcForwardIrpSynchronous(
- ULONG DeviceObject,
- ULONG Irp 
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL 
-PcGetContentRights(
- ULONG ContentId,
- ULONG DrmRights
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcGetDeviceProperty(
- ULONG DeviceObject,
- ULONG DeviceProperty,
- ULONG BufferLength,
- ULONG PropertyBuffer,
- ULONG ResultLength
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @implemented
- */
-ULONGLONG STDCALL
-PcGetTimeInterval(
-  ULONGLONG  Timei
-)
-{
-    LARGE_INTEGER CurrentTime;
-    
-    KeQuerySystemTime( &CurrentTime);
-
-    return (Timei - CurrentTime.QuadPart);
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcInitializeAdapterDriver(
- ULONG DriverObject,
- ULONG RegistryPathName,
- ULONG AddDevice
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcNewDmaChannel(
- ULONG OutDmaChannel,
- ULONG Unknown,
- ULONG PoolType,
- ULONG DeviceDescription,
- ULONG DeviceObject
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcNewInterruptSync(
- ULONG OutInterruptSync,
- ULONG Unknown,
- ULONG ResourceList,
- ULONG ResourceIndex,
- ULONG Mode
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcNewMiniport(
- ULONG OutMiniport,
- ULONG ClassId
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcNewPort(
- ULONG OutPort,
- ULONG ClassId
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcNewRegistryKey(
- ULONG OutRegistryKey,
- ULONG Unknown,
- ULONG RegistryKeyType,
- ULONG DesiredAccess,
- ULONG DeviceObject,
- ULONG SubDevice,
- ULONG ObjectAttributes,
- ULONG CreateOptions,
- ULONG Disposition
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcNewResourceList(
- ULONG OutResourceList,
- ULONG Unknown,
- ULONG PoolType,
- ULONG TranslatedResources,
- ULONG UntranslatedResources
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcNewResourceSublist(
- ULONG OutResourceList,
- ULONG Unknown,
- ULONG PoolType,
- ULONG ParentList,
- ULONG MaximumEntries
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcNewServiceGroup(
- ULONG OutServiceGroup,
- ULONG Unknown
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcRegisterAdapterPowerManagement(
- ULONG Unknown,
- ULONG pvContext
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcRegisterIoTimeout(
- ULONG pDeviceObject,
- ULONG pTimerRoutine,
- ULONG pContext
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcRegisterPhysicalConnection(
- ULONG DeviceObject,
- ULONG FromUnknown,
- ULONG FromPin,
- ULONG ToUnknown,
- ULONG ToPin
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcRegisterPhysicalConnectionFromExternal(
- ULONG DeviceObject,
- ULONG FromString,
- ULONG FromPin,
- ULONG ToUnknown,
- ULONG ToPin
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcRegisterPhysicalConnectionToExternal(
- ULONG DeviceObject,
- ULONG FromUnknown,
- ULONG FromPin,
- ULONG ToString,
- ULONG ToPin
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcRegisterSubdevice(
- ULONG DeviceObject,
- ULONG SubdevName,
- ULONG Unknown
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcRequestNewPowerState(
- ULONG pDeviceObject,
- ULONG RequestedNewState
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-PcUnregisterIoTimeout(
- ULONG pDeviceObject,
- ULONG pTimerRoutine,
- ULONG pContext
-)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
-
diff --git a/drivers/multimedia/portcls.NEW/portcls.def b/drivers/multimedia/portcls.NEW/portcls.def
deleted file mode 100644 (file)
index 4ad6a01..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-;
-; Exports definition file for portcls.sys
-;
-EXPORTS
-DllInitialize@4
-DllUnload@0
-
-; Adapters (adapter.c)
-PcAddAdapterDevice@20
-PcInitializeAdapterDriver@12
-
-; Factories
-PcNewDmaChannel@20
-PcNewInterruptSync@20
-PcNewMiniport@8
-PcNewPort@8
-PcNewRegistryKey@36
-PcNewResourceList@20
-PcNewResourceSublist@20
-PcNewServiceGroup@8
-
-; Digital Rights Management (drm.c)
-PcAddContentHandlers@12
-PcCreateContentMixed@12
-PcDestroyContent@4
-PcForwardContentToDeviceObject@12
-PcForwardContentToFileObject@8
-PcForwardContentToInterface@12
-PcGetContentRights@8
-
-; IRP Helpers
-PcCompleteIrp@12
-PcDispatchIrp@8
-PcForwardIrpSynchronous@8
-
-; Misc
-PcGetTimeInterval@8
-PcRegisterSubdevice@12
-
-; Physical Connections
-PcRegisterPhysicalConnection@20
-PcRegisterPhysicalConnectionFromExternal@20
-PcRegisterPhysicalConnectionToExternal@20
-
-; Power Management
-PcRegisterAdapterPowerManagement@8
-PcRequestNewPowerState@8
-
-; Properties
-PcCompletePendingPropertyRequest@8
-PcGetDeviceProperty@20
-
-; Timeouts
-PcRegisterIoTimeout@12
-PcUnregisterIoTimeout@12
diff --git a/drivers/multimedia/portcls.NEW/portcls.h b/drivers/multimedia/portcls.NEW/portcls.h
deleted file mode 100644 (file)
index 4dc027d..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
-
-    Move to w32api when it is ready.
-
- */
-#ifndef _PORTCLS_H
-#define _PORTCLS_H
-#if __GNUC__ >=3
-#pragma GCC system_header
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This header is total bull**** */
-
-#include <ntddk.h>
-
-#define PORTCLASSAPI extern
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcAddAdapterDevice(
- ULONG DriverObject,
- ULONG PhysicalDeviceObject,
- ULONG StartDevice,
- ULONG MaxObjects,
- ULONG DeviceExtensionSize
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcAddContentHandlers(
- ULONG  ContentId,
- ULONG  paHandlers,
- ULONG  NumHandlers
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcCompleteIrp(
- ULONG  DeviceObject,
- ULONG  Irp,
- ULONG  Status
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcCompletePendingPropertyRequest(
- ULONG PropertyRequest,
- ULONG NtStatus
-);
-
-PORTCLASSAPI NTSTATUS STDCALL 
-PcCreateContentMixed(
- ULONG paContentId,
- ULONG cContentId,
- ULONG pMixedContentId
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcDestroyContent(
- ULONG ContentId
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcDispatchIrp(
- ULONG DeviceObject,
- ULONG Irp
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcForwardContentToDeviceObject(
- ULONG ContentId,
- ULONG Reserved,
- ULONG DrmForward
-);
-
-PORTCLASSAPI NTSTATUS STDCALL 
-PcForwardContentToFileObject(
- ULONG ContentId,
- ULONG FileObject
-);
-
-PORTCLASSAPI NTSTATUS STDCALL 
-PcForwardContentToInterface(
- ULONG ContentId,
- ULONG Unknown,
- ULONG NumMethods
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcForwardIrpSynchronous(
- ULONG DeviceObject,
- ULONG Irp 
-);
-
-PORTCLASSAPI NTSTATUS STDCALL 
-PcGetContentRights(
- ULONG ContentId,
- ULONG DrmRights
-); 
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcGetDeviceProperty(
- ULONG DeviceObject,
- ULONG DeviceProperty,
- ULONG BufferLength,
- ULONG PropertyBuffer,
- ULONG ResultLength
-);
-
-PORTCLASSAPI ULONGLONG STDCALL
-PcGetTimeInterval(
-  ULONGLONG  Timei
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcInitializeAdapterDriver(
- ULONG DriverObject,
- ULONG RegistryPathName,
- ULONG AddDevice
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcNewDmaChannel(
- ULONG OutDmaChannel,
- ULONG Unknown,
- ULONG PoolType,
- ULONG DeviceDescription,
- ULONG DeviceObject
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcNewInterruptSync(
- ULONG OutInterruptSync,
- ULONG Unknown,
- ULONG ResourceList,
- ULONG ResourceIndex,
- ULONG Mode
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcNewMiniport(
- ULONG OutMiniport,
- ULONG ClassId
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcNewPort(
- ULONG OutPort,
- ULONG ClassId
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcNewRegistryKey(
- ULONG OutRegistryKey,
- ULONG Unknown,
- ULONG RegistryKeyType,
- ULONG DesiredAccess,
- ULONG DeviceObject,
- ULONG SubDevice,
- ULONG ObjectAttributes,
- ULONG CreateOptions,
- ULONG Disposition
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcNewResourceList(
- ULONG OutResourceList,
- ULONG Unknown,
- ULONG PoolType,
- ULONG TranslatedResources,
- ULONG UntranslatedResources
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcNewResourceSublist(
- ULONG OutResourceList,
- ULONG Unknown,
- ULONG PoolType,
- ULONG ParentList,
- ULONG MaximumEntries
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcNewServiceGroup(
- ULONG OutServiceGroup,
- ULONG Unknown
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcRegisterAdapterPowerManagement(
- ULONG Unknown,
- ULONG pvContext
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcRegisterIoTimeout(
- ULONG pDeviceObject,
- ULONG pTimerRoutine,
- ULONG pContext
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcRegisterPhysicalConnection(
- ULONG DeviceObject,
- ULONG FromUnknown,
- ULONG FromPin,
- ULONG ToUnknown,
- ULONG ToPin
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcRegisterPhysicalConnectionFromExternal(
- ULONG DeviceObject,
- ULONG FromString,
- ULONG FromPin,
- ULONG ToUnknown,
- ULONG ToPin
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcRegisterPhysicalConnectionToExternal(
- ULONG DeviceObject,
- ULONG FromUnknown,
- ULONG FromPin,
- ULONG ToString,
- ULONG ToPin
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcRegisterSubdevice(
- ULONG DeviceObject,
- ULONG SubdevName,
- ULONG Unknown
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcRequestNewPowerState(
- ULONG pDeviceObject,
- ULONG RequestedNewState
-);
-
-PORTCLASSAPI NTSTATUS STDCALL
-PcUnregisterIoTimeout(
- ULONG pDeviceObject,
- ULONG pTimerRoutine,
- ULONG pContext
-);
-
-#ifdef __cplusplus
-}
-#endif                          
-
-#endif
diff --git a/drivers/multimedia/portcls.NEW/portcls.rbuild b/drivers/multimedia/portcls.NEW/portcls.rbuild
deleted file mode 100644 (file)
index 9502652..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<module name="portcls" type="exportdriver" installbase="system32/drivers" installname="portcls.sys" allowwarnings="true">
-        <importlibrary definition="portcls.def" />
-       <define name="__USE_W32API" />
-       <include base="portcls">../include</include>
-       <library>ntoskrnl</library>
-       <library>drmk</library>
-    <file>dll.c</file>
-       <file>adapter.c</file>
-       <file>drm.c</file>
-       <file>stubs.c</file>
-       <file>portcls.rc</file>
-</module>
diff --git a/drivers/multimedia/portcls.NEW/portcls.rc b/drivers/multimedia/portcls.NEW/portcls.rc
deleted file mode 100644 (file)
index 03edd6d..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#define REACTOS_VERSION_DLL
-#define REACTOS_STR_FILE_DESCRIPTION   "PORTCLS Port Class Driver API\0"
-#define REACTOS_STR_INTERNAL_NAME      "portcls\0"
-#define REACTOS_STR_ORIGINAL_FILENAME  "portcls.sys\0"
-#include <reactos/version.rc>
diff --git a/drivers/multimedia/portcls.NEW/stubs.c b/drivers/multimedia/portcls.NEW/stubs.c
deleted file mode 100644 (file)
index 36d59b7..0000000
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
-    Port Class API
-    Stubbed functions
-*/
-
-#include <portcls.h>
-
-/*
-    Factory Stubs
-*/
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcNewDmaChannel(
-    OUT PDMACHANNEL* OutDmaChannel,
-    IN  PUNKNOWN OuterUnknown OPTIONAL,
-    IN  POOL_TYPE PoolType,
-    IN  PDEVICE_DESCRIPTION DeviceDescription,
-    IN  PDEVICE_OBJECT DeviceObject)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcNewInterruptSync(
-    OUT PINTERRUPTSYNC* OUtInterruptSync,
-    IN  PUNKNOWN OuterUnknown OPTIONAL,
-    IN  PRESOURCELIST ResourceList,
-    IN  ULONG ResourceIndex,
-    IN  INTERRUPTSYNCMODE Mode)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcNewMiniport(
-    OUT PMINIPORT* OutMiniport,
-    IN  REFCLSID ClassId)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcNewPort(
-    OUT PPORT* OutPort,
-    IN  REFCLSID ClassId)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcNewRegistryKey(
-    OUT PREGISTRYKEY* OutRegistryKey,
-    IN  PUNKNOWN OuterUnknown OPTIONAL,
-    IN  ULONG RegistryKeyType,
-    IN  ACCESS_MASK DesiredAccess,
-    IN  PVOID DeviceObject OPTIONAL,
-    IN  PVOID SubDevice OPTIONAL,
-    IN  POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
-    IN  ULONG CreateOptions OPTIONAL,
-    OUT PULONG Disposition OPTIONAL)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcNewResourceList(
-    OUT PRESOURCELIST* OutResourceList,
-    IN  PUNKNOWN OuterUnknown OPTIONAL,
-    IN  POOL_TYPE PoolType,
-    IN  PCM_RESOURCE_LIST TranslatedResources,
-    IN  PCM_RESOURCE_LIST UntranslatedResources)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcNewResourceSublist(
-    OUT PRESOURCELIST* OutResourceList,
-    IN  PUNKNOWN OuterUnknown OPTIONAL,
-    IN  POOL_TYPE PoolType,
-    IN  PRESOURCELIST ParentList,
-    IN  ULONG MaximumEntries)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcNewServiceGroup(
-    OUT PSERVICEGROUP* OutServiceGroup,
-    IN  PUNKNOWN OuterUnknown OPTIONAL)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-
-/* ===============================================================
-    IRP Handling
-*/
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcDispatchIrp(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PIRP Irp)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcCompleteIrp(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PIRP Irp,
-    IN  NTSTATUS Status)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcForwardIrpSynchronous(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PIRP Irp)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-
-/* ===============================================================
-    Power Management
-*/
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcRegisterAdapterPowerManagement(
-    IN  PUNKNOWN pUnknown,
-    IN  PVOID pvContext1)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcRequestNewPowerState(
-    IN  PDEVICE_OBJECT pDeviceObject,
-    IN  DEVICE_POWER_STATE RequestedNewState)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-
-/* ===============================================================
-    Properties
-*/
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcGetDeviceProperty(
-    IN  PVOID DeviceObject,
-    IN  DEVICE_REGISTRY_PROPERTY DeviceProperty,
-    IN  ULONG BufferLength,
-    OUT PVOID PropertyBuffer,
-    OUT PULONG ResultLength)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcCompletePendingPropertyRequest(
-    IN  PPCPROPERTY_REQUEST PropertyRequest,
-    IN  NTSTATUS NtStatus)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-
-/* ===============================================================
-    I/O Timeouts
-*/
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcRegisterIoTimeout(
-    IN  PDEVICE_OBJECT pDeviceObject,
-    IN  PIO_TIMER_ROUTINE pTimerRoutine,
-    IN  PVOID pContext)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcUnregisterIoTimeout(
-    IN  PDEVICE_OBJECT pDeviceObject,
-    IN  PIO_TIMER_ROUTINE pTimerRoutine,
-    IN  PVOID pContext)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-
-/* ===============================================================
-    Physical Connections
-*/
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcRegisterPhysicalConnection(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PUNKNOWN FromUnknown,
-    IN  ULONG FromPin,
-    IN  PUNKNOWN ToUnknown,
-    IN  ULONG ToPin)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcRegisterPhysicalConnectionFromExternal(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PUNICODE_STRING FromString,
-    IN  ULONG FromPin,
-    IN  PUNKNOWN ToUnknown,
-    IN  ULONG ToPin)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcRegisterPhysicalConnectionToExternal(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PUNKNOWN FromUnknown,
-    IN  ULONG FromPin,
-    IN  PUNICODE_STRING ToString,
-    IN  ULONG ToPin)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-
-/* ===============================================================
-    Misc
-*/
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI ULONGLONG NTAPI
-PcGetTimeInterval(
-    IN  ULONGLONG Since)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
- * @unimplemented
- */
-PORTCLASSAPI NTSTATUS NTAPI
-PcRegisterSubdevice(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PWCHAR Name,
-    IN  PUNKNOWN Unknown)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
diff --git a/drivers/multimedia/x/allocators.c b/drivers/multimedia/x/allocators.c
deleted file mode 100644 (file)
index 4fc778b..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ===============================================================
-    Allocator Functions
-*/
-
-#include <ks.h>
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsCreateAllocator(
-    IN  HANDLE ConnectionHandle,
-    IN  PKSALLOCATOR_FRAMING AllocatorFraming,
-    OUT PHANDLE AllocatorHandle)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsCreateDefaultAllocator(
-    IN  PIRP Irp)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsValidateAllocatorCreateRequest(
-    IN  PIRP Irp,
-    OUT PKSALLOCATOR_FRAMING* AllocatorFraming)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsCreateDefaultAllocatorEx(
-    IN  PIRP Irp,
-    IN  PVOID InitializeContext OPTIONAL,
-    IN  PFNKSDEFAULTALLOCATE DefaultAllocate OPTIONAL,
-    IN  PFNKSDEFAULTFREE DefaultFree OPTIONAL,
-    IN  PFNKSINITIALIZEALLOCATOR InitializeAllocator OPTIONAL,
-    IN  PFNKSDELETEALLOCATOR DeleteAllocator OPTIONAL)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsValidateAllocatorFramingEx(
-    IN  PKSALLOCATOR_FRAMING_EX Framing,
-    IN  ULONG BufferSize,
-    IN  const KSALLOCATOR_FRAMING_EX* PinFraming)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
diff --git a/drivers/multimedia/x/clocks.c b/drivers/multimedia/x/clocks.c
deleted file mode 100644 (file)
index a075bbf..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/* ===============================================================
-    Clock Functions
-*/
-
-#include <ks.h>
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsCreateClock(
-    IN  HANDLE ConnectionHandle,
-    IN  PKSCLOCK_CREATE ClockCreate,
-    OUT PHANDLE ClockHandle)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsCreateDefaultClock(
-    IN  PIRP Irp,
-    IN  PKSDEFAULTCLOCK DefaultClock)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsAllocateDefaultClock(
-    OUT PKSDEFAULTCLOCK* DefaultClock)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsAllocateDefaultClockEx(
-    OUT PKSDEFAULTCLOCK* DefaultClock,
-    IN  PVOID Context OPTIONAL,
-    IN  PFNKSSETTIMER SetTimer OPTIONAL,
-    IN  PFNKSCANCELTIMER CancelTimer OPTIONAL,
-    IN  PFNKSCORRELATEDTIME CorrelatedTime OPTIONAL,
-    IN  const KSRESOLUTION* Resolution OPTIONAL,
-    IN  ULONG Flags)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsFreeDefaultClock(
-    IN  PKSDEFAULTCLOCK DefaultClock)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsValidateClockCreateRequest(
-    IN  PIRP Irp,
-    OUT PKSCLOCK_CREATE* ClockCreate)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI KSSTATE NTAPI
-KsGetDefaultClockState(
-    IN  PKSDEFAULTCLOCK DefaultClock)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsSetDefaultClockState(
-    IN  PKSDEFAULTCLOCK DefaultClock,
-    IN  KSSTATE State)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI LONGLONG NTAPI
-KsGetDefaultClockTime(
-    IN  PKSDEFAULTCLOCK DefaultClock)
-{
-    UNIMPLEMENTED;
-    return 0;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsSetDefaultClockTime(
-    IN  PKSDEFAULTCLOCK DefaultClock,
-    IN  LONGLONG Time)
-{
-    UNIMPLEMENTED;
-}
diff --git a/drivers/multimedia/x/connectivity.c b/drivers/multimedia/x/connectivity.c
deleted file mode 100644 (file)
index 23defde..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-    KsCreatePin
-    KsValidateConnectRequest
-    KsPinPropertyHandler
-    KsPinDataIntersection
-    KsHandleSizedListQuery
-*/
-
-#include <ks.h>
-
-KSDDKAPI NTSTATUS NTAPI
-KsCreatePin(
-    IN  HANDLE FilterHandle,
-    IN  PKSPIN_CONNECT Connect,
-    IN  ACCESS_MASK DesiredAccess,
-    OUT PHANDLE ConnectionHandle)
-{
-    return STATUS_SUCCESS;
-}
-
-KSDDKAPI NTSTATUS NTAPI
-KsValidateConnectRequest(
-    IN  PIRP Irp,
-    IN  ULONG DescriptorsCount,
-    IN  KSPIN_DESCRIPTOR* Descriptor,
-    OUT PKSPIN_CONNECT* Connect)
-{
-    return STATUS_SUCCESS;
-}
-
-KSDDKAPI NTSTATUS NTAPI
-KsPinPropertyHandler(
-    IN  PIRP Irp,
-    IN  PKSPROPERTY Property,
-    IN  OUT PVOID Data,
-    IN  ULONG DescriptorsCount,
-    IN  const KSPIN_DESCRIPTOR* Descriptor)
-{
-    return STATUS_SUCCESS;
-}
-
-KSDDKAPI NTSTATUS NTAPI
-KsPinDataIntersection(
-    IN  PIRP Irp,
-    IN  PKSPIN Pin,
-    OUT PVOID Data,
-    IN  ULONG DescriptorsCount,
-    IN  const KSPIN_DESCRIPTOR* Descriptor,
-    IN  PFNKSINTERSECTHANDLER IntersectHandler)
-{
-    return STATUS_SUCCESS;
-}
-
-/* Does this belong here? */
-
-KSDDKAPI NTSTATUS NTAPI
-KsHandleSizedListQuery(
-    IN  PIRP Irp,
-    IN  ULONG DataItemsCount,
-    IN  ULONG DataItemSize,
-    IN  const VOID* DataItems)
-{
-    return STATUS_SUCCESS;
-}
diff --git a/drivers/multimedia/x/events.c b/drivers/multimedia/x/events.c
deleted file mode 100644 (file)
index 814d65e..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <ks.h>
-
-/* ===============================================================
-    Event Functions
-*/
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsGenerateEvent(
-    IN  PKSEVENT_ENTRY EntryEvent)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsEnableEventWithAllocator(
-    IN  PIRP Irp,
-    IN  ULONG EventSetsCount,
-    IN  PKSEVENT_SET EventSet,
-    IN  OUT PLIST_ENTRY EventsList OPTIONAL,
-    IN  KSEVENTS_LOCKTYPE EventsFlags OPTIONAL,
-    IN  PVOID EventsLock OPTIONAL,
-    IN  PFNKSALLOCATOR Allocator OPTIONAL,
-    IN  ULONG EventItemSize OPTIONAL)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsGenerateDataEvent(
-    IN  PKSEVENT_ENTRY EventEntry,
-    IN  ULONG DataSize,
-    IN  PVOID Data)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsEnableEvent(
-    IN  PIRP Irp,
-    IN  ULONG EventSetsCount,
-    IN  KSEVENT_SET* EventSet,
-    IN  OUT PLIST_ENTRY EventsList OPTIONAL,
-    IN  KSEVENTS_LOCKTYPE EventsFlags OPTIONAL,
-    IN  PVOID EventsLock OPTIONAL)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsDiscardEvent(
-    IN  PKSEVENT_ENTRY EventEntry)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsDisableEvent(
-    IN  PIRP Irp,
-    IN  OUT PLIST_ENTRY EventsList,
-    IN  KSEVENTS_LOCKTYPE EventsFlags,
-    IN  PVOID EventsLock)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsFreeEventList(
-    IN  PFILE_OBJECT FileObject,
-    IN  OUT PLIST_ENTRY EventsList,
-    IN  KSEVENTS_LOCKTYPE EVentsFlags,
-    IN  PVOID EventsLock)
-{
-    UNIMPLEMENTED;
-}
diff --git a/drivers/multimedia/x/irp.c b/drivers/multimedia/x/irp.c
deleted file mode 100644 (file)
index 8924ee6..0000000
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
-    ReactOS Kernel Streaming
-    IRP Helpers
-*/
-
-#include <ks.h>
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsAcquireResetValue(
-    IN  PIRP Irp,
-    OUT KSRESET* ResetValue)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsAddIrpToCancelableQueue(
-    IN  OUT PLIST_ENTRY QueueHead,
-    IN  PKSPIN_LOCK SpinLock,
-    IN  PIRP Irp,
-    IN  KSLIST_ENTRY_LOCATION ListLocation,
-    IN  PDRIVER_CANCEL DriverCancel OPTIONAL)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsAddObjectCreateItemToDeviceHeader(
-    IN  KSDEVICE_HEADER Header,
-    IN  PDRIVER_DISPATCH Create,
-    IN  PVOID Context,
-    IN  PWCHAR ObjectClass,
-    IN  PSECURITY_DESCRIPTOR SecurityDescriptor)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsAddObjectCreateItemToObjectHeader(
-    IN  KSOBJECT_HEADER Header,
-    IN  PDRIVER_DISPATCH Create,
-    IN  PVOID Context,
-    IN  PWCHAR ObjectClass,
-    IN  PSECURITY_DESCRIPTOR SecurityDescriptor)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsAllocateDeviceHeader(
-    OUT PVOID Header,
-    IN  ULONG ItemsCount,
-    IN  PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsAllocateExtraData(
-    IN  PIRP Irp,
-    IN  ULONG ExtraSize,
-    OUT PVOID* ExtraBuffer)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsAllocateObjectCreateItem(
-    IN  KSDEVICE_HEADER Header,
-    IN  PKSOBJECT_CREATE_ITEM CreateItem,
-    IN  BOOL AllocateEntry,
-    IN  PFNKSITEMFREECALLBACK ItemFreeCallback OPTIONAL)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsAllocateObjectHeader(
-    OUT PVOID Header,
-    IN  ULONG ItemsCount,
-    IN  PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL,
-    IN  PIRP Irp,
-    IN  KSDISPATCH_TABLE* Table)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsCancelIo(
-    IN  OUT PLIST_ENTRY QueueHead,
-    IN  PKSPIN_LOCK SpinLock)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsCancelRoutine(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PIRP Irp)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsDefaultDeviceIoCompletion(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PIRP Irp)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI BOOLEAN NTAPI
-KsDispatchFastIoDeviceControlFailure(
-    IN  PFILE_OBJECT FileObject,
-    IN  BOOLEAN Wait,
-    IN  PVOID InputBuffer  OPTIONAL,
-    IN  ULONG InputBufferLength,
-    OUT PVOID OutputBuffer  OPTIONAL,
-    IN  ULONG OutputBufferLength,
-    IN  ULONG IoControlCode,
-    OUT PIO_STATUS_BLOCK IoStatus,
-    IN  PDEVICE_OBJECT DeviceObject)   /* always return false */
-{
-    return FALSE;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI BOOLEAN NTAPI
-KsDispatchFastReadFailure(
-    IN  PFILE_OBJECT FileObject,
-    IN  PLARGE_INTEGER FileOffset,
-    IN  ULONG Length,
-    IN  BOOLEAN Wait,
-    IN  ULONG LockKey,
-    OUT PVOID Buffer,
-    OUT PIO_STATUS_BLOCK IoStatus,
-    IN  PDEVICE_OBJECT DeviceObject)   /* always return false */
-{
-    return FALSE;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsDispatchInvalidDeviceRequest(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PIRP Irp)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsDispatchIrp(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PIRP Irp)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsDispatchSpecificMethod(
-    IN  PIRP Irp,
-    IN  PFNKSHANDLER Handler)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsDispatchSpecificProperty(
-    IN  PIRP Irp,
-    IN  PFNKSHANDLER Handler)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsForwardAndCatchIrp(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PIRP Irp,
-    IN  PFILE_OBJECT FileObject,
-    IN  KSSTACK_USE StackUse)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsForwardIrp(
-    IN  PIRP Irp,
-    IN  PFILE_OBJECT FileObject,
-    IN  BOOLEAN ReuseStackLocation)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsFreeDeviceHeader(
-    IN  PVOID Header)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsFreeObjectHeader(
-    IN  PVOID Header)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsGetChildCreateParameter(
-    IN  PIRP Irp,
-    OUT PVOID* CreateParameter)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsMoveIrpsOnCancelableQueue(
-    IN  OUT PLIST_ENTRY SourceList,
-    IN  PKSPIN_LOCK SourceLock,
-    IN  OUT PLIST_ENTRY DestinationList,
-    IN  PKSPIN_LOCK DestinationLock OPTIONAL,
-    IN  KSLIST_ENTRY_LOCATION ListLocation,
-    IN  PFNKSIRPLISTCALLBACK ListCallback,
-    IN  PVOID Context)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsProbeStreamIrp(
-    IN  PIRP Irp,
-    IN  ULONG ProbeFlags,
-    IN  ULONG HeaderSize)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsQueryInformationFile(
-    IN  PFILE_OBJECT FileObject,
-    OUT PVOID FileInformation,
-    IN  ULONG Length,
-    IN  FILE_INFORMATION_CLASS FileInformationClass)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI ACCESS_MASK NTAPI
-KsQueryObjectAccessMask(
-    IN KSOBJECT_HEADER Header)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI PKSOBJECT_CREATE_ITEM NTAPI
-KsQueryObjectCreateItem(
-    IN KSOBJECT_HEADER Header)
-{
-    UNIMPLEMENTED;
-/*    return STATUS_UNSUCCESSFUL; */
-    return NULL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsReadFile(
-    IN  PFILE_OBJECT FileObject,
-    IN  PKEVENT Event OPTIONAL,
-    IN  PVOID PortContext OPTIONAL,
-    OUT PIO_STATUS_BLOCK IoStatusBlock,
-    OUT PVOID Buffer,
-    IN  ULONG Length,
-    IN  ULONG Key OPTIONAL,
-    IN  KPROCESSOR_MODE RequestorMode)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsReleaseIrpOnCancelableQueue(
-    IN  PIRP Irp,
-    IN  PDRIVER_CANCEL DriverCancel OPTIONAL)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI PIRP NTAPI
-KsRemoveIrpFromCancelableQueue(
-    IN  OUT PLIST_ENTRY QueueHead,
-    IN  PKSPIN_LOCK SpinLock,
-    IN  KSLIST_ENTRY_LOCATION ListLocation,
-    IN  KSIRP_REMOVAL_OPERATION RemovalOperation)
-{
-    UNIMPLEMENTED;
-    return NULL;
-    /*return STATUS_UNSUCCESSFUL; */
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsRemoveSpecificIrpFromCancelableQueue(
-    IN  PIRP Irp)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsSetInformationFile(
-    IN  PFILE_OBJECT FileObject,
-    IN  PVOID FileInformation,
-    IN  ULONG Length,
-    IN  FILE_INFORMATION_CLASS FileInformationClass)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsSetMajorFunctionHandler(
-    IN  PDRIVER_OBJECT DriverObject,
-    IN  ULONG MajorFunction)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsStreamIo(
-    IN  PFILE_OBJECT FileObject,
-    IN  PKEVENT Event OPTIONAL,
-    IN  PVOID PortContext OPTIONAL,
-    IN  PIO_COMPLETION_ROUTINE CompletionRoutine OPTIONAL,
-    IN  PVOID CompletionContext OPTIONAL,
-    IN  KSCOMPLETION_INVOCATION CompletionInvocationFlags OPTIONAL,
-    OUT PIO_STATUS_BLOCK IoStatusBlock,
-    IN  OUT PVOID StreamHeaders,
-    IN  ULONG Length,
-    IN  ULONG Flags,
-    IN  KPROCESSOR_MODE RequestorMode)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-  KsWriteFile(
-    IN  PFILE_OBJECT FileObject,
-    IN  PKEVENT Event OPTIONAL,
-    IN  PVOID PortContext OPTIONAL,
-    OUT PIO_STATUS_BLOCK IoStatusBlock,
-    IN  PVOID Buffer,
-    IN  ULONG Length,
-    IN  ULONG Key OPTIONAL,
-    IN  KPROCESSOR_MODE RequestorMode)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
diff --git a/drivers/multimedia/x/ks.def b/drivers/multimedia/x/ks.def
deleted file mode 100644 (file)
index f146fc5..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-;
-; Exports definition file for ks.sys
-;
-
-EXPORTS
-KsCreateAllocator@12
-KsCreateDefaultAllocator@4
-KsValidateAllocatorCreateRequest@8
-KsCreateDefaultAllocatorEx@24
-KsValidateAllocatorFramingEx@12
-
-KsCreateClock@12
-KsCreateDefaultClock@8
-KsAllocateDefaultClock@4
-KsAllocateDefaultClockEx@28
-KsFreeDefaultClock@4
-KsValidateClockCreateRequest@8
-KsGetDefaultClockState@4
-KsSetDefaultClockState@8
-KsGetDefaultClockTime@4
-KsSetDefaultClockTime@12
-
-KsMethodHandler@12
-KsMethodHandlerWithAllocator@20
-KsFastMethodHandler@32
-
-KsPropertyHandler@12
-KsPropertyHandlerWithAllocator@20
-KsUnserializeObjectPropertiesFromRegistry@12
-KsFastPropertyHandler@32
-
-KsGenerateEvent@4
-KsEnableEventWithAllocator@32
-KsGenerateDataEvent@12
-KsEnableEvent@24
-KsDiscardEvent@4
-KsDisableEvent@16
-KsFreeEventList@16
-
-KsValidateTopologyNodeCreateRequest@12
-KsCreateTopologyNode@16
-KsTopologyPropertyHandler@16
-
-KsCreatePin@16
-KsValidateConnectRequest@16
-KsPinPropertyHandler@20
-KsPinDataIntersection@24
-
-KsHandleSizedListQuery@16
-
-KsAcquireResetValue@8
-KsAddIrpToCancelableQueue@20
-KsAddObjectCreateItemToDeviceHeader@20
-KsAddObjectCreateItemToObjectHeader@20
-KsAllocateDeviceHeader@12
-KsAllocateExtraData@12
-KsAllocateObjectCreateItem@16
-KsAllocateObjectHeader@20
-KsCancelIo@8
-KsCancelRoutine@8
-KsDefaultDeviceIoCompletion@8
-KsDispatchFastIoDeviceControlFailure@36
-KsDispatchFastReadFailure@32
-; KsDispatchFastWriteFailure@32
-KsDispatchInvalidDeviceRequest@8
-KsDispatchIrp@8
-KsDispatchSpecificMethod@8
-KsDispatchSpecificProperty@8
-KsForwardAndCatchIrp@16
-KsForwardIrp@12
-KsFreeDeviceHeader@4
-KsFreeObjectHeader@4
-KsGetChildCreateParameter@8
-KsMoveIrpsOnCancelableQueue@28
-KsProbeStreamIrp@12
-KsQueryInformationFile@16
-KsQueryObjectAccessMask@4
-KsQueryObjectCreateItem@4
-KsReadFile@32
-KsReleaseIrpOnCancelableQueue@8
-KsRemoveIrpFromCancelableQueue@16
-KsRemoveSpecificIrpFromCancelableQueue@4
-KsSetInformationFile@16
-KsSetMajorFunctionHandler@8
-KsStreamIo@44
-KsWriteFile@32
-
-KsRegisterWorker@8
-KsUnregisterWorker@4
-KsRegisterCountedWorker@12
-KsDecrementCountedWorker@4
-KsIncrementCountedWorker@4
-KsQueueWorkItem@8
-
-KsCacheMedium@12
-KsDefaultDispatchPnp@8
-KsSetDevicePnpAndBaseObject@12
-KsDefaultDispatchPower@8
-KsSetPowerDispatch@12
-KsReferenceBusObject@4
-KsDereferenceBusObject@4
-KsFreeObjectCreateItem@8
-KsFreeObjectCreateItemsByContext@8
-KsLoadResource@24
-; KsNullDriverUnload@4
-KsPinDataIntersectionEx@32
-KsQueryDevicePnpObject@4
-KsRecalculateStackDepth@8
-KsSetTargetDeviceObject@8
-KsSetTargetState@8
-KsSynchronousIoControlDevice@32
diff --git a/drivers/multimedia/x/ks.rbuild b/drivers/multimedia/x/ks.rbuild
deleted file mode 100644 (file)
index cf7675c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<module name="ks" type="exportdriver" installbase="system32/drivers" installname="ks.sys" allowwarnings="true">
-       <include base="ks">.</include>
-       <include base="ks">..</include>
-       <include base="ks">../include</include>
-       <importlibrary definition="ks.def" />
-       <library>ntoskrnl</library>
-       <define name="__USE_W32API" />
-       <define name="BUILDING_KS" />
-       <file>ks.rc</file>
-       <file>allocators.c</file>
-       <file>clocks.c</file>
-       <file>connectivity.c</file>
-       <file>events.c</file>
-       <file>irp.c</file>
-       <file>methods.c</file>
-       <file>misc.c</file>
-       <file>properties.c</file>
-       <file>topology.c</file>
-       <file>worker.c</file>
-</module>
diff --git a/drivers/multimedia/x/ks.rc b/drivers/multimedia/x/ks.rc
deleted file mode 100644 (file)
index 197b820..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#define REACTOS_VERSION_DLL
-#define REACTOS_STR_FILE_DESCRIPTION   "Kernel Streaming API\0"
-#define REACTOS_STR_INTERNAL_NAME      "ks\0"
-#define REACTOS_STR_ORIGINAL_FILENAME  "ks.sys\0"
-#include <reactos/version.rc>
diff --git a/drivers/multimedia/x/methods.c b/drivers/multimedia/x/methods.c
deleted file mode 100644 (file)
index f766c1b..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ===============================================================
-    Method Functions
-*/
-
-#include <ks.h>
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsMethodHandler(
-    IN  PIRP Irp,
-    IN  ULONG MethodSetsCount,
-    IN  PKSMETHOD_SET MethodSet)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsMethodHandlerWithAllocator(
-    IN  PIRP Irp,
-    IN  ULONG MethodSetsCount,
-    IN  PKSMETHOD_SET MethodSet,
-    IN  PFNKSALLOCATOR Allocator OPTIONAL,
-    IN  ULONG MethodItemSize OPTIONAL)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI BOOLEAN NTAPI
-KsFastMethodHandler(
-    IN  PFILE_OBJECT FileObject,
-    IN  PKSMETHOD UNALIGNED Method,
-    IN  ULONG MethodLength,
-    IN  OUT PVOID UNALIGNED Data,
-    IN  ULONG DataLength,
-    OUT PIO_STATUS_BLOCK IoStatus,
-    IN  ULONG MethodSetsCount,
-    IN  const KSMETHOD_SET* MethodSet)
-{
-    UNIMPLEMENTED;
-    return FALSE;
-}
diff --git a/drivers/multimedia/x/misc.c b/drivers/multimedia/x/misc.c
deleted file mode 100644 (file)
index 7e5303e..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-#include <ks.h>
-
-/* ===============================================================
-    Misc. Helper Functions
-*/
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsCacheMedium(
-    IN  PUNICODE_STRING SymbolicLink,
-    IN  PKSPIN_MEDIUM Medium,
-    IN  DWORD PinDirection)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsDefaultDispatchPnp(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PIRP Irp)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsSetDevicePnpAndBaseObject(
-    IN  KSDEVICE_HEADER Header,
-    IN  PDEVICE_OBJECT PnpDeviceObject,
-    IN  PDEVICE_OBJECT BaseDevice)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsDefaultDispatchPower(
-    IN  PDEVICE_OBJECT DeviceObject,
-    IN  PIRP Irp)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsSetPowerDispatch(
-    IN  KSOBJECT_HEADER Header,
-    IN  PFNKSCONTEXT_DISPATCH PowerDispatch OPTIONAL,
-    IN  PVOID PowerContext OPTIONAL)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsReferenceBusObject(
-    IN  KSDEVICE_HEADER Header)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsDereferenceBusObject(
-    IN  KSDEVICE_HEADER Header)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsFreeObjectCreateItem(
-    IN  KSDEVICE_HEADER Header,
-    IN  PUNICODE_STRING CreateItem)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsFreeObjectCreateItemsByContext(
-    IN  KSDEVICE_HEADER Header,
-    IN  PVOID Context)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsLoadResource(
-    IN  PVOID ImageBase,
-    IN  POOL_TYPE PoolType,
-    IN  ULONG_PTR ResourceName,
-    IN  ULONG ResourceType,
-    OUT PVOID* Resource,
-    OUT PULONG ResourceSize)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-VOID
-KsNullDriverUnload(
-    IN  PDRIVER_OBJECT DriverObject)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsPinDataIntersectionEx(
-    IN  PIRP Irp,
-    IN  PKSP_PIN Pin,
-    OUT PVOID Data,
-    IN  ULONG DescriptorsCount,
-    IN  const KSPIN_DESCRIPTOR* Descriptor,
-    IN  ULONG DescriptorSize,
-    IN  PFNKSINTERSECTHANDLEREX IntersectHandler OPTIONAL,
-    IN  PVOID HandlerContext OPTIONAL)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI PDEVICE_OBJECT NTAPI
-KsQueryDevicePnpObject(
-    IN  KSDEVICE_HEADER Header)
-{
-    UNIMPLEMENTED;
-    return NULL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsRecalculateStackDepth(
-    IN  KSDEVICE_HEADER Header,
-    IN  BOOLEAN ReuseStackLocation)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsSetTargetDeviceObject(
-    IN  KSOBJECT_HEADER Header,
-    IN  PDEVICE_OBJECT TargetDevice OPTIONAL)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsSetTargetState(
-    IN  KSOBJECT_HEADER Header,
-    IN  KSTARGET_STATE TargetState)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsSynchronousIoControlDevice(
-    IN  PFILE_OBJECT FileObject,
-    IN  KPROCESSOR_MODE RequestorMode,
-    IN  DWORD IoControl,
-    IN  PVOID InBuffer,
-    IN  ULONG InSize,
-    OUT PVOID OutBuffer,
-    IN  ULONG OUtSize,
-    OUT PULONG BytesReturned)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
diff --git a/drivers/multimedia/x/properties.c b/drivers/multimedia/x/properties.c
deleted file mode 100644 (file)
index 84a2237..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <ks.h>
-
-/* ===============================================================
-    Property Functions
-*/
-
-/*
-    @unimplemented
-*/
-KSDDKAPI BOOLEAN NTAPI
-KsFastPropertyHandler(
-    IN  PFILE_OBJECT FileObject,
-    IN  PKSPROPERTY UNALIGNED Property,
-    IN  ULONG PropertyLength,
-    IN  OUT PVOID UNALIGNED Data,
-    IN  ULONG DataLength,
-    OUT PIO_STATUS_BLOCK IoStatus,
-    IN  ULONG PropertySetsCount,
-    IN  const KSPROPERTY_SET* PropertySet)
-{
-    UNIMPLEMENTED;
-    return FALSE;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsPropertyHandler(
-    IN  PIRP Irp,
-    IN  ULONG PropertySetsCount,
-    IN  const KSPROPERTY_SET* PropertySet)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsPropertyHandlerWithAllocator(
-    IN  PIRP Irp,
-    IN  ULONG PropertySetsCount,
-    IN  PKSPROPERTY_SET PropertySet,
-    IN  PFNKSALLOCATOR Allocator OPTIONAL,
-    IN  ULONG PropertyItemSize OPTIONAL)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsUnserializeObjectPropertiesFromRegistry(
-    IN  PFILE_OBJECT FileObject,
-    IN  HANDLE ParentKey OPTIONAL,
-    IN  PUNICODE_STRING RegistryPath OPTIONAL)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
diff --git a/drivers/multimedia/x/topology.c b/drivers/multimedia/x/topology.c
deleted file mode 100644 (file)
index df50494..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <ks.h>
-
-/* ===============================================================
-    Topology Functions
-*/
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsCreateTopologyNode(
-    IN  HANDLE ParentHandle,
-    IN  PKSNODE_CREATE NodeCreate,
-    IN  ACCESS_MASK DesiredAccess,
-    OUT PHANDLE NodeHandle)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsValidateTopologyNodeCreateRequest(
-    IN  PIRP Irp,
-    IN  PKSTOPOLOGY Topology,
-    OUT PKSNODE_CREATE* NodeCreate)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsTopologyPropertyHandler(
-    IN  PIRP Irp,
-    IN  PKSPROPERTY Property,
-    IN  OUT PVOID Data,
-    IN  const KSTOPOLOGY* Topology)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
diff --git a/drivers/multimedia/x/worker.c b/drivers/multimedia/x/worker.c
deleted file mode 100644 (file)
index f47e9a2..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/* ===============================================================
-    Worker Management Functions
-*/
-
-#include <ks.h>
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsRegisterWorker(
-    IN  WORK_QUEUE_TYPE WorkQueueType,
-    OUT PKSWORKER* Worker)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI VOID NTAPI
-KsUnregisterWorker(
-    IN  PKSWORKER Worker)
-{
-    UNIMPLEMENTED;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsRegisterCountedWorker(
-    IN  WORK_QUEUE_TYPE WorkQueueType,
-    IN  PWORK_QUEUE_ITEM CountedWorkItem,
-    OUT PKSWORKER* Worker)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI ULONG NTAPI
-KsDecrementCountedWorker(
-    IN  PKSWORKER Worker)
-{
-    UNIMPLEMENTED;
-    return 0;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI ULONG NTAPI
-KsIncrementCountedWorker(
-    IN  PKSWORKER Worker)
-{
-    UNIMPLEMENTED;
-    return 0;
-}
-
-/*
-    @unimplemented
-*/
-KSDDKAPI NTSTATUS NTAPI
-KsQueueWorkItem(
-    IN  PKSWORKER Worker,
-    IN  PWORK_QUEUE_ITEM WorkItem)
-{
-    UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
-}
diff --git a/drivers/usb/usbehci/common.c b/drivers/usb/usbehci/common.c
deleted file mode 100644 (file)
index f31eb9b..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * PROJECT:     ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        drivers/usb/usbehci/common.c
- * PURPOSE:     Common operations.
- * PROGRAMMERS:
- *              Michael Martin (michael.martin@reactos.org)
- */
-
-#define INITGUID
-#include "usbehci.h"
-#include <wdmguid.h>
-#include <stdio.h>
-
-VOID
-DumpDeviceDescriptor(PUSB_DEVICE_DESCRIPTOR DeviceDescriptor)
-{
-    DPRINT1("Dumping Device Descriptor %x\n", DeviceDescriptor);
-    DPRINT1("bLength %x\n", DeviceDescriptor->bLength);
-    DPRINT1("bDescriptorType %x\n", DeviceDescriptor->bDescriptorType);
-    DPRINT1("bcdUSB %x\n", DeviceDescriptor->bcdUSB);
-    DPRINT1("bDeviceClass %x\n", DeviceDescriptor->bDeviceClass);
-    DPRINT1("bDeviceSubClass %x\n", DeviceDescriptor->bDeviceSubClass);
-    DPRINT1("bDeviceProtocol %x\n", DeviceDescriptor->bDeviceProtocol);
-    DPRINT1("bMaxPacketSize0 %x\n", DeviceDescriptor->bMaxPacketSize0);
-    DPRINT1("idVendor %x\n", DeviceDescriptor->idVendor);
-    DPRINT1("idProduct %x\n", DeviceDescriptor->idProduct);
-    DPRINT1("bcdDevice %x\n", DeviceDescriptor->bcdDevice);
-    DPRINT1("iManufacturer %x\n", DeviceDescriptor->iManufacturer);
-    DPRINT1("iProduct %x\n", DeviceDescriptor->iProduct);
-    DPRINT1("iSerialNumber %x\n", DeviceDescriptor->iSerialNumber);
-    DPRINT1("bNumConfigurations %x\n", DeviceDescriptor->bNumConfigurations);
-}
-
-VOID
-DumpFullConfigurationDescriptor(PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor)
-{
-    PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
-    PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
-    LONG i, j;
-
-    DPRINT1("Dumping ConfigurationDescriptor %x\n", ConfigurationDescriptor);
-    DPRINT1("bLength %x\n", ConfigurationDescriptor->bLength);
-    DPRINT1("bDescriptorType %x\n", ConfigurationDescriptor->bDescriptorType);
-    DPRINT1("wTotalLength %x\n", ConfigurationDescriptor->wTotalLength);
-    DPRINT1("bNumInterfaces %x\n", ConfigurationDescriptor->bNumInterfaces);
-    DPRINT1("bConfigurationValue %x\n", ConfigurationDescriptor->bConfigurationValue);
-    DPRINT1("iConfiguration %x\n", ConfigurationDescriptor->iConfiguration);
-    DPRINT1("bmAttributes %x\n", ConfigurationDescriptor->bmAttributes);
-    DPRINT1("MaxPower %x\n", ConfigurationDescriptor->MaxPower);
-
-    InterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR) ((ULONG_PTR)ConfigurationDescriptor + sizeof(USB_CONFIGURATION_DESCRIPTOR));
-
-    for (i=0; i < ConfigurationDescriptor->bNumInterfaces; i++)
-    {
-        DPRINT1("- Dumping InterfaceDescriptor %x\n", InterfaceDescriptor);
-        DPRINT1("  bLength %x\n", InterfaceDescriptor->bLength);
-        DPRINT1("  bDescriptorType %x\n", InterfaceDescriptor->bDescriptorType);
-        DPRINT1("  bInterfaceNumber %x\n", InterfaceDescriptor->bInterfaceNumber);
-        DPRINT1("  bAlternateSetting %x\n", InterfaceDescriptor->bAlternateSetting);
-        DPRINT1("  bNumEndpoints %x\n", InterfaceDescriptor->bNumEndpoints);
-        DPRINT1("  bInterfaceClass %x\n", InterfaceDescriptor->bInterfaceClass);
-        DPRINT1("  bInterfaceSubClass %x\n", InterfaceDescriptor->bInterfaceSubClass);
-        DPRINT1("  bInterfaceProtocol %x\n", InterfaceDescriptor->bInterfaceProtocol);
-        DPRINT1("  iInterface %x\n", InterfaceDescriptor->iInterface);
-
-        EndpointDescriptor = (PUSB_ENDPOINT_DESCRIPTOR) ((ULONG_PTR)InterfaceDescriptor + sizeof(USB_INTERFACE_DESCRIPTOR));
-
-        for (j=0; j < InterfaceDescriptor->bNumEndpoints; j++)
-        {
-            DPRINT1("   bLength %x\n", EndpointDescriptor->bLength);
-            DPRINT1("   bDescriptorType %x\n", EndpointDescriptor->bDescriptorType);
-            DPRINT1("   bEndpointAddress %x\n", EndpointDescriptor->bEndpointAddress);
-            DPRINT1("   bmAttributes %x\n", EndpointDescriptor->bmAttributes);
-            DPRINT1("   wMaxPacketSize %x\n", EndpointDescriptor->wMaxPacketSize);
-            DPRINT1("   bInterval %x\n", EndpointDescriptor->bInterval);
-            EndpointDescriptor = (PUSB_ENDPOINT_DESCRIPTOR) ((ULONG_PTR)EndpointDescriptor + sizeof(USB_ENDPOINT_DESCRIPTOR));
-        }
-        InterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR)(ULONG_PTR)EndpointDescriptor;
-    }
-
-}
-
-VOID
-DumpQueueHead(PQUEUE_HEAD QueueHead)
-{
-    DPRINT1("Dumping QueueHead %x\n", QueueHead);
-    DPRINT1("    CurrentLinkPointer %x\n", QueueHead->CurrentLinkPointer);
-    DPRINT1("    NextPointer %x\n", QueueHead->NextPointer);
-    DPRINT1("    AlternateNextPointer %x\n", QueueHead->AlternateNextPointer);
-    DPRINT1("    HorizontalLinkPointer %x\n", QueueHead->HorizontalLinkPointer);
-    DPRINT1("    Active %x\n", QueueHead->Token.Bits.Active);
-    DPRINT1("    Halted %x\n", QueueHead->Token.Bits.Halted);
-    DPRINT1("    DataBufferError %x\n", QueueHead->Token.Bits.DataBufferError);
-    DPRINT1("    BabbleDetected %x\n", QueueHead->Token.Bits.BabbleDetected);
-    DPRINT1("    TransactionError %x\n", QueueHead->Token.Bits.TransactionError);
-    DPRINT1("    MissedMicroFrame %x\n", QueueHead->Token.Bits.MissedMicroFrame);
-    DPRINT1("    PingState %x\n", QueueHead->Token.Bits.PingState);        
-    DPRINT1("    SplitTransactionState %x\n", QueueHead->Token.Bits.SplitTransactionState);
-    DPRINT1("    ErrorCounter %x\n", QueueHead->Token.Bits.ErrorCounter);
-    DPRINT1("    First TransferDescriptor %x\n", QueueHead->FirstTransferDescriptor);
-}
-
-VOID
-DumpTransferDescriptor(PQUEUE_TRANSFER_DESCRIPTOR TransferDescriptor)
-{
-    DPRINT1("Dumping Descriptor %x\n", TransferDescriptor);
-    DPRINT1("    Active %x\n", TransferDescriptor->Token.Bits.Active);
-    DPRINT1("    Halted %x\n", TransferDescriptor->Token.Bits.Halted);
-    DPRINT1("    DataBufferError %x\n", TransferDescriptor->Token.Bits.DataBufferError);
-    DPRINT1("    BabbleDetected %x\n", TransferDescriptor->Token.Bits.BabbleDetected);
-    DPRINT1("    TransactionError %x\n", TransferDescriptor->Token.Bits.TransactionError);
-    DPRINT1("    MissedMicroFrame %x\n", TransferDescriptor->Token.Bits.MissedMicroFrame);
-    DPRINT1("    PingState %x\n", TransferDescriptor->Token.Bits.PingState);        
-    DPRINT1("    SplitTransactionState %x\n", TransferDescriptor->Token.Bits.SplitTransactionState);
-    DPRINT1("    ErrorCounter %x\n", TransferDescriptor->Token.Bits.ErrorCounter);
-}
-
-NTSTATUS NTAPI
-GetBusInterface(PDEVICE_OBJECT DeviceObject, PBUS_INTERFACE_STANDARD busInterface)
-{
-    KEVENT Event;
-    NTSTATUS Status;
-    PIRP Irp;
-    IO_STATUS_BLOCK IoStatus;
-    PIO_STACK_LOCATION Stack;
-
-    if ((!DeviceObject) || (!busInterface))
-        return STATUS_UNSUCCESSFUL;
-
-    KeInitializeEvent(&Event, NotificationEvent, FALSE);
-
-    Irp = IoBuildSynchronousFsdRequest(IRP_MJ_PNP,
-                                       DeviceObject,
-                                       NULL,
-                                       0,
-                                       NULL,
-                                       &Event,
-                                       &IoStatus);
-
-    if (Irp == NULL)
-    {
-        return STATUS_INSUFFICIENT_RESOURCES;
-    }
-
-    Stack=IoGetNextIrpStackLocation(Irp);
-    Stack->MajorFunction = IRP_MJ_PNP;
-    Stack->MinorFunction = IRP_MN_QUERY_INTERFACE;
-    Stack->Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD);
-    Stack->Parameters.QueryInterface.InterfaceType = (LPGUID)&GUID_BUS_INTERFACE_STANDARD;
-    Stack->Parameters.QueryInterface.Version = 1;
-    Stack->Parameters.QueryInterface.Interface = (PINTERFACE)busInterface;
-    Stack->Parameters.QueryInterface.InterfaceSpecificData = NULL;
-    Irp->IoStatus.Status=STATUS_NOT_SUPPORTED ;
-
-    Status=IoCallDriver(DeviceObject, Irp);
-
-    if (Status == STATUS_PENDING)
-    {
-        KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
-
-        Status=IoStatus.Status;
-    }
-
-    return Status;
-}
-
-NTSTATUS NTAPI
-ForwardAndWaitCompletionRoutine(PDEVICE_OBJECT DeviceObject, PIRP Irp, PKEVENT Event)
-{
-    if (Irp->PendingReturned)
-    {
-        KeSetEvent(Event, IO_NO_INCREMENT, FALSE);
-    }
-    return STATUS_MORE_PROCESSING_REQUIRED;
-}
-
-NTSTATUS NTAPI
-ForwardAndWait(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
-    PFDO_DEVICE_EXTENSION DeviceExtensions;
-    KEVENT Event;
-    NTSTATUS Status;
-
-
-    DeviceExtensions = DeviceObject->DeviceExtension; 
-    KeInitializeEvent(&Event, NotificationEvent, FALSE);
-    IoCopyCurrentIrpStackLocationToNext(Irp);
-    IoSetCompletionRoutine(Irp, (PIO_COMPLETION_ROUTINE)ForwardAndWaitCompletionRoutine, &Event, TRUE, TRUE, TRUE);
-    Status = IoCallDriver(DeviceExtensions->LowerDevice, Irp);
-    if (Status == STATUS_PENDING)
-    {
-        KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
-        Status = Irp->IoStatus.Status;
-    }
-
-    return Status;
-}
-
-NTSTATUS NTAPI
-ForwardIrpAndForget(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
-    PDEVICE_OBJECT LowerDevice;
-
-    LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
-    ASSERT(LowerDevice);
-
-    IoSkipCurrentIrpStackLocation(Irp);
-    return IoCallDriver(LowerDevice, Irp);
-}
-
-/* Copied fom trunk PCI drivers */
-NTSTATUS
-DuplicateUnicodeString(ULONG Flags, PCUNICODE_STRING SourceString, PUNICODE_STRING DestinationString)
-{
-    if (SourceString == NULL || DestinationString == NULL
-     || SourceString->Length > SourceString->MaximumLength
-     || (SourceString->Length == 0 && SourceString->MaximumLength > 0 && SourceString->Buffer == NULL)
-     || Flags == RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING || Flags >= 4)
-    {
-        return STATUS_INVALID_PARAMETER;
-    }
-
-
-    if ((SourceString->Length == 0)
-     && (Flags != (RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE |
-                   RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING)))
-    {
-        DestinationString->Length = 0;
-        DestinationString->MaximumLength = 0;
-        DestinationString->Buffer = NULL;
-    }
-    else
-    {
-        USHORT DestMaxLength = SourceString->Length;
-
-        if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
-            DestMaxLength += sizeof(UNICODE_NULL);
-
-        DestinationString->Buffer = ExAllocatePoolWithTag(NonPagedPool, DestMaxLength, USB_POOL_TAG);
-        if (DestinationString->Buffer == NULL)
-            return STATUS_NO_MEMORY;
-
-        RtlCopyMemory(DestinationString->Buffer, SourceString->Buffer, SourceString->Length);
-        DestinationString->Length = SourceString->Length;
-        DestinationString->MaximumLength = DestMaxLength;
-
-        if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
-            DestinationString->Buffer[DestinationString->Length / sizeof(WCHAR)] = 0;
-    }
-
-    return STATUS_SUCCESS;
-}
-
diff --git a/drivers/usb/usbehci/fdo.c b/drivers/usb/usbehci/fdo.c
deleted file mode 100644 (file)
index 805d43e..0000000
+++ /dev/null
@@ -1,877 +0,0 @@
-/*
- * PROJECT:     ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        drivers/usb/usbehci/fdo.c
- * PURPOSE:     USB EHCI device driver.
- * PROGRAMMERS:
- *              Michael Martin (michael.martin@reactos.org)
- */
-
-#include "hwiface.h"
-#include "usbehci.h"
-#include "physmem.h"
-#include <stdio.h>
-
-VOID NTAPI
-EhciDefferedRoutine(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
-{
-    PFDO_DEVICE_EXTENSION FdoDeviceExtension;
-    PPDO_DEVICE_EXTENSION PdoDeviceExtension;
-    ULONG CStatus;
-    ULONG tmp;
-    ULONG OpRegisters;
-    PEHCI_HOST_CONTROLLER hcd;
-    int i;
-
-    FdoDeviceExtension = (PFDO_DEVICE_EXTENSION) DeferredContext;
-
-    /* Nothing is valid if the Pdo is NULL */
-    if (!FdoDeviceExtension->Pdo)
-    {
-        DPRINT1("PDO not set yet!\n");
-        return;
-    }
-
-    PdoDeviceExtension = (PPDO_DEVICE_EXTENSION) FdoDeviceExtension->Pdo->DeviceExtension;
-
-    OpRegisters = (ULONG)FdoDeviceExtension->hcd.OpRegisters;
-
-    hcd = &FdoDeviceExtension->hcd;
-
-    CStatus = (ULONG) SystemArgument2;
-
-    /* If Reclamation (The QueueHead list has been transveresed twice),
-       look through the queuehead list and find queue heads that have been 
-       1. Halted due to error
-       2. Transfer completion.
-       Move these QueueHeads to a temporary list that is used to pend memory release.
-       Either an Event is signalled or an Irp is completed depending on what was set during transfer request
-       setup. Next software issue a "DoorBell" that informs the controller the Asynchronous List is about to 
-       be modified.
-       After the controller acks this with interrupt, the memory for queueheads are released. */
-
-    if (CStatus & (EHCI_STS_RECL| EHCI_STS_INT | EHCI_ERROR_INT))
-    {
-        PQUEUE_HEAD CurrentQH;
-        PQUEUE_TRANSFER_DESCRIPTOR CurrentTD;
-        BOOLEAN QueueHeadCompleted;
-
-        /* Go through the list and delink completed (not active) QueueHeads */
-        CurrentQH = hcd->AsyncListQueue;
-        CurrentQH = CurrentQH->NextQueueHead;
-
-        while ((CurrentQH) && (CurrentQH != hcd->AsyncListQueue))
-        {
-            DPRINT1("Checking QueueHead %x, Next %x\n", CurrentQH, CurrentQH->NextQueueHead);
-            DPRINT1("Active %d, Halted %d\n", CurrentQH->Token.Bits.Active, CurrentQH->Token.Bits.Halted);
-
-            /* if the QueueHead has completed */
-            if (!CurrentQH->Token.Bits.Active)
-            {
-                /* Assume success */
-                USBD_STATUS UrbStatus = USBD_STATUS_SUCCESS;
-
-                QueueHeadCompleted = TRUE;
-
-                /* Check the Status of the QueueHead */
-                if (CurrentQH->Token.Bits.Halted)
-                {
-                    if (CurrentQH->Token.Bits.DataBufferError)
-                    {
-                        DPRINT1("Data buffer error\n");
-                        UrbStatus = USBD_STATUS_DATA_BUFFER_ERROR;
-                    }
-                    else if (CurrentQH->Token.Bits.BabbleDetected)
-                    {
-                        DPRINT1("Babble Detected\n");
-                        UrbStatus = USBD_STATUS_BABBLE_DETECTED;
-                    }
-                    else
-                    {
-                        DPRINT1("Stall PID\n");
-                        UrbStatus = USBD_STATUS_STALL_PID;
-                    }
-                }
-                
-                /* Check the Descriptors */
-                CurrentTD = CurrentQH->FirstTransferDescriptor;
-                while (CurrentTD)
-                {
-                    /* FIXME: What needs to happen if the QueueHead was marked as complete but descriptors was not */
-                    if ((CurrentTD->Token.Bits.Active) || (CurrentTD->Token.Bits.Halted))
-                    {
-                        /* The descriptor was not completed */
-                        QueueHeadCompleted = FALSE;
-                        DPRINT1("QueueHead was marked as completed but contains descriptors that were not completed\n");
-                        ASSERT(FALSE);
-                        break;
-                    }
-                    CurrentTD = CurrentTD->NextDescriptor;
-                }
-
-                if ((QueueHeadCompleted) || (CurrentQH->Token.Bits.Halted))
-                {
-                    PQUEUE_HEAD FreeQH;
-                    
-                    FreeQH = CurrentQH;
-                    CurrentQH = CurrentQH->NextQueueHead;
-                    DPRINT1("QueueHead %x has completed. Removing\n", FreeQH);
-                    /* Move it into the completed list */
-                    UnlinkQueueHead(hcd, FreeQH);
-                    LinkQueueHeadToCompletedList(hcd, FreeQH);
-                    DPRINT1("Remove done\n");
-
-                    /* If the Event is set then the caller is waiting on completion */
-                    if (FreeQH->Event)
-                    {
-                        KeSetEvent(FreeQH->Event, IO_NO_INCREMENT, FALSE);
-                    }
-
-                    /* If there is an IrpToComplete then the caller did not wait on completion
-                       and the IRP was marked as PENDING. Complete it now. */
-                    if (FreeQH->IrpToComplete)
-                    {
-                        PIRP Irp;
-                        PIO_STACK_LOCATION Stack;
-                        PURB Urb;
-
-                        Irp = FreeQH->IrpToComplete;
-                        Stack = IoGetCurrentIrpStackLocation(Irp);
-                        ASSERT(Stack);
-                        Urb = (PURB) Stack->Parameters.Others.Argument1;
-                        ASSERT(Urb);
-
-                        /* Check for error */
-                        if (CStatus & EHCI_ERROR_INT)
-                        {
-                            Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
-                            Irp->IoStatus.Information = 0;
-                            /* Set BufferLength to 0 as there was error */
-                            if (Urb->UrbHeader.Function == URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE)
-                            {
-                                Urb->UrbControlDescriptorRequest.TransferBufferLength = 0;
-                            }
-                            DPRINT1("There was an Error, TransferBufferLength set to 0\n");
-                        }
-                        else
-                        {
-                            if (Urb->UrbHeader.Function == URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE)
-                            {
-                                if (Urb->UrbControlDescriptorRequest.TransferBufferLength >=
-                                    ((PUSB_COMMON_DESCRIPTOR)(Urb->UrbControlDescriptorRequest.TransferBuffer))->bLength)
-                                {
-                                    Urb->UrbControlDescriptorRequest.TransferBufferLength =
-                                        ((PUSB_COMMON_DESCRIPTOR)(Urb->UrbControlDescriptorRequest.TransferBuffer))->bLength;
-                                }
-                            }
-
-                            Irp->IoStatus.Status = STATUS_SUCCESS;
-                            Irp->IoStatus.Information = 0;
-                            DPRINT1("Completing Irp\n");
-                        }
-                        Urb->UrbHeader.Status = UrbStatus;
-                        IoCompleteRequest(Irp,  IO_NO_INCREMENT);
-                    }
-
-                    /* FIXME: Move to static function */
-                    PEHCI_USBCMD_CONTENT UsbCmd;
-                    /* Ring the DoorBell so that host controller knows a QueueHead was removed */
-                    DPRINT1("Ringing Doorbell\n");
-                    tmp = READ_REGISTER_ULONG((PULONG) (OpRegisters + EHCI_USBCMD));
-                    UsbCmd = (PEHCI_USBCMD_CONTENT) &tmp;
-                    UsbCmd->DoorBell = TRUE;
-                    WRITE_REGISTER_ULONG((PULONG) (OpRegisters +  EHCI_USBCMD), tmp);
-                    continue;
-                }
-            }
-
-            CurrentQH = CurrentQH->NextQueueHead;
-        }
-    }
-
-    
-    /* Port Change. */
-    /* FIXME: Use EnumControllerPorts instead */
-    if (CStatus & EHCI_STS_PCD)
-    {
-        /* Loop through the ports */
-        for (i = 0; i < hcd->ECHICaps.HCSParams.PortCount; i++)
-        {
-            tmp = READ_REGISTER_ULONG((PULONG) ((OpRegisters + EHCI_PORTSC) + (4 * i)));
-
-            /* Check for port change on this port */
-            if (tmp & 0x02)
-            {
-                /* Clear status change */
-                tmp = READ_REGISTER_ULONG((PULONG)((OpRegisters + EHCI_PORTSC) + (4 * i)));
-                tmp |= 0x02;
-                WRITE_REGISTER_ULONG((PULONG) ((OpRegisters + EHCI_PORTSC) + (4 * i)), tmp);
-                
-                /* Connect or Disconnect? */
-                if (tmp & 0x01)
-                {
-                    DPRINT1("Device connected on port %d\n", i);
-
-                    /* Check if a companion host controller exists */
-                    if (hcd->ECHICaps.HCSParams.CHCCount)
-                    {
-                        tmp = READ_REGISTER_ULONG((PULONG)((OpRegisters + EHCI_PORTSC) + (4 * i)));
-
-                        /* Port should be in disabled state, as per USB 2.0 specs */
-                        if (tmp & 0x04)
-                        {
-                            DPRINT1("Warning: The port the device has just connected to is not disabled!\n");
-                        }
-
-                        /* Is this non high speed device */
-                        if (tmp & 0x400)
-                        {
-                            DPRINT1("Non HighSpeed device connected. Releasing ownership.\n");
-                            /* Release ownership to companion host controller */
-                            WRITE_REGISTER_ULONG((PULONG) ((OpRegisters + EHCI_PORTSC) + (4 * i)), 0x2000);
-                            continue;
-                        }
-                    }
-
-                    KeStallExecutionProcessor(30);
-
-                    /* FIXME: Hub driver does this also, is it needed here? */
-                    /* As per USB 2.0 Specs, 9.1.2. Reset the port and clear the status change */
-                    //tmp |= 0x100 | 0x02;
-                    /* Sanity, Disable port */
-                    //tmp &= ~0x04;
-
-                    //WRITE_REGISTER_ULONG((PULONG) ((Base + EHCI_PORTSC) + (4 * i)), tmp);
-
-                    //KeStallExecutionProcessor(20);
-
-                    tmp = READ_REGISTER_ULONG((PULONG)((OpRegisters + EHCI_PORTSC) + (4 * i)));
-
-                    PdoDeviceExtension->ChildDeviceCount++;
-                    hcd->Ports[i].PortStatus &= ~0x8000;
-                    hcd->Ports[i].PortStatus |= USB_PORT_STATUS_HIGH_SPEED;
-                    hcd->Ports[i].PortStatus |= USB_PORT_STATUS_CONNECT;
-                    hcd->Ports[i].PortChange |= USB_PORT_STATUS_CONNECT;
-                    DPRINT1("Completing URB\n");
-                    CompletePendingURBRequest(PdoDeviceExtension);
-                }
-                else
-                {
-                    DPRINT1("Device disconnected on port %d\n", i);
-                }
-            }
-        }
-    }
-
-    /* Asnyc Advance */
-    if (CStatus & EHCI_STS_IAA)
-    {
-        DPRINT1("Async Advance!\n");
-        CleanupAsyncList(hcd);
-    }
-}
-
-BOOLEAN NTAPI
-InterruptService(PKINTERRUPT Interrupt, PVOID ServiceContext)
-{
-    PFDO_DEVICE_EXTENSION FdoDeviceExtension;
-    PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT) ServiceContext;
-    PEHCI_HOST_CONTROLLER hcd;
-    ULONG CStatus = 0;
-
-    FdoDeviceExtension = (PFDO_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
-
-    hcd = &FdoDeviceExtension->hcd;
-
-    /* Read device status */
-    CStatus = ReadControllerStatus(hcd);
-
-    CStatus &= (EHCI_ERROR_INT | EHCI_STS_INT | EHCI_STS_IAA | EHCI_STS_PCD | EHCI_STS_FLR | EHCI_STS_RECL);
-
-    if ((!CStatus) || (FdoDeviceExtension->DeviceState == 0))
-    {
-        /* This interrupt isnt for us or not ready for it. */
-        return FALSE;
-    }
-    
-    /* Clear status */
-    ClearControllerStatus(hcd, CStatus);
-
-    if (CStatus & EHCI_STS_RECL)
-    {
-        DPRINT("Reclamation\n");
-    }
-
-    if (CStatus & EHCI_ERROR_INT)
-    {
-        DPRINT1("EHCI Status=0x%x\n", CStatus);
-        /* This check added in case the NT USB Driver is still loading.
-           It will cause this error condition at every device connect. */
-        if(CStatus & EHCI_STS_PCD)
-        {
-            DPRINT1("EHCI Error: Another driver may be interfering with proper operation of this driver\n");
-            DPRINT1("  Hint: Ensure that the old NT Usb Driver has been removed!\n");
-            ASSERT(FALSE);
-        }
-    }
-
-    if (CStatus & EHCI_STS_FATAL)
-    {
-        DPRINT1("EHCI: Host System Error. Possible PCI problems.\n");
-        ASSERT(FALSE);
-    }
-
-    if (CStatus & EHCI_STS_HALT)
-    {
-        DPRINT1("EHCI: Host Controller unexpected halt.\n");
-        /* FIXME: Reset the controller */
-    }
-
-    KeInsertQueueDpc(&FdoDeviceExtension->DpcObject, FdoDeviceExtension, (PVOID)CStatus);
-    return TRUE;
-}
-
-NTSTATUS
-StartDevice(PDEVICE_OBJECT DeviceObject, PCM_PARTIAL_RESOURCE_LIST raw, PCM_PARTIAL_RESOURCE_LIST translated)
-{
-    PFDO_DEVICE_EXTENSION FdoDeviceExtension;
-    PCM_PARTIAL_RESOURCE_DESCRIPTOR resource;
-    DEVICE_DESCRIPTION DeviceDescription;
-    PEHCI_HOST_CONTROLLER hcd;
-    ULONG NumberResources;
-    ULONG iCount;
-    ULONG DeviceAddress;
-    ULONG PropertySize;
-    ULONG BusNumber;
-    NTSTATUS Status;
-
-    FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
-    hcd = &FdoDeviceExtension->hcd;
-
-    /* Sanity Checks */
-    Status = IoGetDeviceProperty(FdoDeviceExtension->LowerDevice,
-                                 DevicePropertyAddress,
-                                 sizeof(ULONG),
-                                 &DeviceAddress,
-                                 &PropertySize);
-
-    Status = IoGetDeviceProperty(FdoDeviceExtension->LowerDevice,
-                                 DevicePropertyBusNumber,
-                                 sizeof(ULONG),
-                                 &BusNumber,
-                                 &PropertySize);
-
-
-    /* Get the resources the PNP Manager gave */
-    NumberResources = translated->Count;
-    DPRINT("NumberResources %d\n", NumberResources);
-    for (iCount = 0; iCount < NumberResources; iCount++)
-    {
-        DPRINT("Resource Info %d:\n", iCount);
-        resource = &translated->PartialDescriptors[iCount];
-        switch(resource->Type)
-        {
-            case CmResourceTypePort:
-            {
-                DPRINT("Port Start: %x\n", resource->u.Port.Start);
-                DPRINT("Port Length %d\n", resource->u.Port.Length);
-                /* FIXME: Handle Ports */
-                break;
-            }
-            case CmResourceTypeInterrupt:
-            {
-                DPRINT("Interrupt Vector: %x\n", resource->u.Interrupt.Vector);
-                FdoDeviceExtension->Vector = resource->u.Interrupt.Vector;
-                FdoDeviceExtension->Irql = resource->u.Interrupt.Level;
-                FdoDeviceExtension->Affinity = resource->u.Interrupt.Affinity;
-                FdoDeviceExtension->Mode = (resource->Flags == CM_RESOURCE_INTERRUPT_LATCHED) ? Latched : LevelSensitive;
-                FdoDeviceExtension->IrqShared = resource->ShareDisposition == CmResourceShareShared;
-                break;
-            }
-            case CmResourceTypeMemory:
-            {
-                PVOID ResourceBase = 0;
-
-                DPRINT("Mem Start: %x\n", resource->u.Memory.Start);
-                DPRINT("Mem Length: %d\n", resource->u.Memory.Length);
-
-                ResourceBase = MmMapIoSpace(resource->u.Memory.Start, resource->u.Memory.Length, FALSE);
-                DPRINT("ResourceBase %x\n", ResourceBase);
-                if (ResourceBase  == NULL)
-                {
-                    DPRINT1("MmMapIoSpace failed!!!!!!!!!\n");
-                }
-
-                GetCapabilities(&FdoDeviceExtension->hcd.ECHICaps, (ULONG)ResourceBase);
-                DPRINT1("hcd.ECHICaps.Length %x\n", FdoDeviceExtension->hcd.ECHICaps.Length);
-                FdoDeviceExtension->hcd.OpRegisters = (ULONG)((ULONG)ResourceBase + FdoDeviceExtension->hcd.ECHICaps.Length);
-                break;
-            }
-            case CmResourceTypeDma:
-            {
-                DPRINT("Dma Channel: %x\n", resource->u.Dma.Channel);
-                DPRINT("Dma Port: %d\n", resource->u.Dma.Port);
-                break;
-            }
-            case CmResourceTypeDevicePrivate:
-            {
-                /* Windows does this. */
-                DPRINT1("CmResourceTypeDevicePrivate not handled\n");
-                break;
-            }
-            default:
-            {
-                DPRINT1("PNP Manager gave resource type not handled!! Notify Developers!\n");
-                break;
-            }
-        }
-    }
-
-    for (iCount = 0; iCount < hcd->ECHICaps.HCSParams.PortCount; iCount++)
-    {
-        hcd->Ports[iCount].PortStatus = 0x8000;
-        hcd->Ports[iCount].PortChange = 0;
-        
-        if (hcd->ECHICaps.HCSParams.PortPowerControl)
-            hcd->Ports[iCount].PortStatus |= USB_PORT_STATUS_POWER;
-    }
-
-    KeInitializeDpc(&FdoDeviceExtension->DpcObject,
-                    EhciDefferedRoutine,
-                    FdoDeviceExtension);
-
-    RtlZeroMemory(&DeviceDescription, sizeof(DEVICE_DESCRIPTION));
-
-    DeviceDescription.Version = DEVICE_DESCRIPTION_VERSION;
-    DeviceDescription.Master = TRUE;
-    DeviceDescription.ScatterGather = TRUE;
-    DeviceDescription.Dma32BitAddresses = TRUE;
-    DeviceDescription.DmaWidth = 2;
-    DeviceDescription.InterfaceType = PCIBus;
-    DeviceDescription.MaximumLength = EHCI_MAX_SIZE_TRANSFER;
-
-    hcd->pDmaAdapter = IoGetDmaAdapter(FdoDeviceExtension->LowerDevice,
-                                       &DeviceDescription,
-                                       &hcd->MapRegisters);
-
-    if (hcd->pDmaAdapter == NULL)
-    {
-        DPRINT1("Ehci: IoGetDmaAdapter failed!\n");
-        ASSERT(FALSE);
-    }
-
-    DPRINT1("MapRegisters %x\n", hcd->MapRegisters);
-
-    /* Allocate Common Buffer for Periodic Frame List */
-    FdoDeviceExtension->PeriodicFrameList.VirtualAddr =
-        hcd->pDmaAdapter->DmaOperations->AllocateCommonBuffer(hcd->pDmaAdapter,
-                                                              sizeof(ULONG) * 1024,
-                                                              &FdoDeviceExtension->PeriodicFrameList.PhysicalAddr,
-                                                              FALSE);
-
-    if (FdoDeviceExtension->PeriodicFrameList.VirtualAddr == NULL)
-    {
-        DPRINT1("Ehci: FdoDeviceExtension->PeriodicFramList is null\n");
-        return STATUS_UNSUCCESSFUL;
-    }
-
-    /* Zeroize it */
-    RtlZeroMemory(FdoDeviceExtension->PeriodicFrameList.VirtualAddr, sizeof(ULONG) * 1024);
-
-    ExInitializeFastMutex(&FdoDeviceExtension->FrameListMutex);
-
-    /* Allocate initial page for queueheads and descriptors */
-    FdoDeviceExtension->hcd.CommonBufferVA[0] =
-        hcd->pDmaAdapter->DmaOperations->AllocateCommonBuffer(hcd->pDmaAdapter,
-                                                              PAGE_SIZE,
-                                                              &FdoDeviceExtension->hcd.CommonBufferPA[0],
-                                                              FALSE);
-
-    if (FdoDeviceExtension->hcd.CommonBufferVA[0] == 0)
-    {
-        DPRINT1("Ehci: Failed to allocate common buffer!\n");
-        return STATUS_UNSUCCESSFUL;
-    }
-
-    hcd->CommonBufferSize = PAGE_SIZE * 16;
-
-    /* Zeroize it */
-    RtlZeroMemory(FdoDeviceExtension->hcd.CommonBufferVA[0],
-                  PAGE_SIZE);
-
-    /* Init SpinLock for host controller device lock */
-    KeInitializeSpinLock(&hcd->Lock);
-
-    /* Reserved a Queue Head that will always be in the AsyncList Address Register. By setting it as the Head of Reclamation
-       the controller can know when it has reached the end of the QueueHead list */
-    hcd->AsyncListQueue = CreateQueueHead(hcd);
-
-    hcd->AsyncListQueue->HorizontalLinkPointer = hcd->AsyncListQueue->PhysicalAddr | QH_TYPE_QH;
-    hcd->AsyncListQueue->EndPointCharacteristics.QEDTDataToggleControl = FALSE;
-    hcd->AsyncListQueue->Token.Bits.InterruptOnComplete = FALSE;
-    hcd->AsyncListQueue->EndPointCharacteristics.HeadOfReclamation = TRUE;
-    hcd->AsyncListQueue->Token.Bits.Halted = TRUE;
-    hcd->AsyncListQueue->NextQueueHead = hcd->AsyncListQueue;
-    hcd->AsyncListQueue->PreviousQueueHead = hcd->AsyncListQueue;
-    
-    /* Reserve a Queue Head thats only purpose is for linking completed Queue Heads.
-       Completed QueueHeads are moved to this temporary. As the memory must still be valid
-       up until the controllers doorbell is rang to let it know info has been removed from QueueHead list */
-    hcd->CompletedListQueue = CreateQueueHead(hcd);
-    hcd->CompletedListQueue->NextQueueHead = hcd->CompletedListQueue;
-    hcd->CompletedListQueue->PreviousQueueHead = hcd->CompletedListQueue;
-    
-    /* Ensure the controller is stopped */
-    StopEhci(hcd);
-    
-    SetAsyncListQueueRegister(hcd, hcd->AsyncListQueue->PhysicalAddr);
-
-    /* FIXME: Implement Periodic Frame List */
-
-    Status = IoConnectInterrupt(&FdoDeviceExtension->EhciInterrupt,
-                                InterruptService,
-                                FdoDeviceExtension->DeviceObject,
-                                NULL,
-                                FdoDeviceExtension->Vector,
-                                FdoDeviceExtension->Irql,
-                                FdoDeviceExtension->Irql,
-                                FdoDeviceExtension->Mode,
-                                FdoDeviceExtension->IrqShared,
-                                FdoDeviceExtension->Affinity,
-                                FALSE);
-
-    StartEhci(hcd);
-    FdoDeviceExtension->DeviceState = DEVICESTARTED;
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS
-FdoQueryBusRelations(
-    PDEVICE_OBJECT DeviceObject,
-    PDEVICE_RELATIONS* pDeviceRelations)
-{
-    PFDO_DEVICE_EXTENSION DeviceExtension;
-    PDEVICE_RELATIONS DeviceRelations = NULL;
-    PDEVICE_OBJECT Pdo;
-    PPDO_DEVICE_EXTENSION PdoDeviceExtension;
-    NTSTATUS Status;
-    ULONG UsbDeviceNumber = 0;
-    WCHAR CharDeviceName[64];
-
-    UNICODE_STRING DeviceName;
-
-    DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
-
-    DPRINT1("Ehci: QueryBusRelations\n");
-
-    /* FIXME: Currently only support for one ehci controller */
-    if (DeviceExtension->Pdo)
-        goto Done;
-
-    /* Create the PDO with the next available number */
-    while (TRUE)
-    {
-        /* FIXME: Use safe string */
-        /* RtlStringCchPrintfW(CharDeviceName, 64, L"USBPDO-%d", UsbDeviceNumber); */
-        swprintf(CharDeviceName, L"\\Device\\USBPDO-%d", UsbDeviceNumber);
-        RtlInitUnicodeString(&DeviceName, CharDeviceName);
-        DPRINT("DeviceName %wZ\n", &DeviceName);
-
-        Status = IoCreateDevice(DeviceObject->DriverObject,
-                                sizeof(PDO_DEVICE_EXTENSION),
-                                &DeviceName,
-                                FILE_DEVICE_BUS_EXTENDER,
-                                0,
-                                FALSE,
-                                &Pdo);
-
-        if (NT_SUCCESS(Status))
-            break;
-
-        if ((Status == STATUS_OBJECT_NAME_EXISTS) || (Status == STATUS_OBJECT_NAME_COLLISION))
-        {
-            /* Try the next name */
-            UsbDeviceNumber++;
-            continue;
-        }
-
-        /* Bail on any other error */
-        if (!NT_SUCCESS(Status))
-        {
-            DPRINT1("Ehci: Failed to create PDO %wZ, Status %x\n", &DeviceName, Status);
-            return Status;
-        }
-    }
-
-    PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)Pdo->DeviceExtension;
-    RtlZeroMemory(PdoDeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
-    PdoDeviceExtension->Common.IsFdo = FALSE;
-
-    PdoDeviceExtension->ControllerFdo = DeviceObject;
-    PdoDeviceExtension->DeviceObject = Pdo;
-    //PdoDeviceExtension->NumberOfPorts = DeviceExtension->hcd.ECHICaps.HCSParams.PortCount;
-
-    InitializeListHead(&PdoDeviceExtension->IrpQueue);
-    
-    KeInitializeSpinLock(&PdoDeviceExtension->IrpQueueLock);
-
-    KeInitializeEvent(&PdoDeviceExtension->QueueDrainedEvent, SynchronizationEvent, TRUE);
-
-    ExInitializeFastMutex(&PdoDeviceExtension->ListLock);
-
-    Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
-
-    DeviceExtension->Pdo = Pdo;
-Done:
-    DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS));
-
-    if (!DeviceRelations)
-    {
-        return STATUS_INSUFFICIENT_RESOURCES;
-    }
-
-    DeviceRelations->Count = 1;
-    DeviceRelations->Objects[0] = DeviceExtension->Pdo;
-    ObReferenceObject(DeviceExtension->Pdo);
-
-    *pDeviceRelations = DeviceRelations;
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS NTAPI
-FdoDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
-{
-    NTSTATUS Status;
-    PIO_STACK_LOCATION Stack = NULL;
-    PCM_PARTIAL_RESOURCE_LIST raw;
-    PCM_PARTIAL_RESOURCE_LIST translated;
-    ULONG_PTR Information = 0;
-
-    Stack =  IoGetCurrentIrpStackLocation(Irp);
-
-    switch(Stack->MinorFunction)
-    {
-        case IRP_MN_START_DEVICE:
-        {
-            DPRINT1("Ehci: START_DEVICE\n");
-
-            Irp->IoStatus.Status = STATUS_SUCCESS;
-            Status = ForwardAndWait(DeviceObject, Irp);
-
-            raw = &Stack->Parameters.StartDevice.AllocatedResources->List[0].PartialResourceList;
-            translated = &Stack->Parameters.StartDevice.AllocatedResourcesTranslated->List[0].PartialResourceList;
-            Status = StartDevice(DeviceObject, raw, translated);
-            break;
-        }
-        case IRP_MN_QUERY_DEVICE_RELATIONS:
-        {
-            DPRINT1("Ehci: IRP_MN_QUERY_DEVICE_RELATIONS\n");
-            switch(Stack->Parameters.QueryDeviceRelations.Type)
-            {
-                case BusRelations:
-                {
-                    PDEVICE_RELATIONS DeviceRelations = NULL;
-                    DPRINT1("Ehci: BusRelations\n");
-                    Status = FdoQueryBusRelations(DeviceObject, &DeviceRelations);
-                    Information = (ULONG_PTR)DeviceRelations;
-                    break;
-                }
-                default:
-                {
-                    DPRINT1("Ehci: Unknown query device relations type\n");
-                    Status = STATUS_NOT_IMPLEMENTED;
-                    break;
-                }
-             }
-             break;
-        }
-        case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
-        {
-            DPRINT1("Ehci: IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
-            return ForwardIrpAndForget(DeviceObject, Irp);
-            break;
-        }
-        case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
-        {
-            DPRINT1("Ehci: IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
-        }
-        case IRP_MN_QUERY_INTERFACE:
-        {
-            DPRINT1("Ehci: IRP_MN_QUERY_INTERFACE\n");
-            Status = STATUS_SUCCESS;
-            Information = 0;
-            Status = ForwardIrpAndForget(DeviceObject, Irp);
-            return Status;
-            break;
-        }
-        default:
-        {
-            DPRINT1("Ehci: IRP_MJ_PNP / Unhandled minor function 0x%lx\n", Stack->MinorFunction);
-            return ForwardIrpAndForget(DeviceObject, Irp);
-        }
-    }
-
-    Irp->IoStatus.Information = Information;
-    Irp->IoStatus.Status = Status;
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-    return Status;
-}
-
-NTSTATUS NTAPI
-AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT Pdo)
-{
-    NTSTATUS Status = STATUS_UNSUCCESSFUL;
-    PDEVICE_OBJECT Fdo;
-    ULONG UsbDeviceNumber = 0;
-    WCHAR CharDeviceName[64];
-    WCHAR CharSymLinkName[64];
-    UNICODE_STRING DeviceName;
-    UNICODE_STRING SymLinkName;
-    UNICODE_STRING InterfaceSymLinkName;
-    ULONG BytesRead;
-    PCI_COMMON_CONFIG PciConfig;
-
-    PFDO_DEVICE_EXTENSION FdoDeviceExtension;
-
-    DPRINT1("Ehci: AddDevice\n");
-
-    /* Create the FDO with next available number */
-    while (TRUE)
-    {
-        /* FIXME: Use safe string sprintf*/
-        /* RtlStringCchPrintfW(CharDeviceName, 64, L"USBFDO-%d", UsbDeviceNumber); */
-        swprintf(CharDeviceName, L"\\Device\\USBFDO-%d", UsbDeviceNumber);
-        RtlInitUnicodeString(&DeviceName, CharDeviceName);
-        DPRINT("DeviceName %wZ\n", &DeviceName);
-
-        Status = IoCreateDevice(DriverObject,
-                                sizeof(FDO_DEVICE_EXTENSION),
-                                &DeviceName,
-                                FILE_DEVICE_CONTROLLER,
-                                0,
-                                FALSE,
-                                &Fdo);
-
-        if (NT_SUCCESS(Status))
-            break;
-
-        if ((Status == STATUS_OBJECT_NAME_EXISTS) || (Status == STATUS_OBJECT_NAME_COLLISION))
-        {
-            /* Try the next name */
-            UsbDeviceNumber++;
-            continue;
-        }
-
-        /* Bail on any other error */
-        if (!NT_SUCCESS(Status))
-        {
-            DPRINT1("UsbEhci: Failed to create %wZ, Status %x\n", &DeviceName, Status);
-            return Status;
-        }
-    }
-
-    swprintf(CharSymLinkName, L"\\Device\\HCD%d", UsbDeviceNumber);
-    RtlInitUnicodeString(&SymLinkName, CharSymLinkName);
-    Status = IoCreateSymbolicLink(&SymLinkName, &DeviceName);
-
-    if (!NT_SUCCESS(Status))
-    {
-        DPRINT1("Warning: Unable to create symbolic link for ehci host controller!\n");
-    }
-
-    FdoDeviceExtension = (PFDO_DEVICE_EXTENSION) Fdo->DeviceExtension;
-    RtlZeroMemory(FdoDeviceExtension, sizeof(PFDO_DEVICE_EXTENSION));
-
-    KeInitializeTimerEx(&FdoDeviceExtension->UpdateTimer, SynchronizationTimer);
-
-    FdoDeviceExtension->Common.IsFdo = TRUE;
-    FdoDeviceExtension->DeviceObject = Fdo;
-
-    FdoDeviceExtension->LowerDevice = IoAttachDeviceToDeviceStack(Fdo, Pdo);
-
-    if (FdoDeviceExtension->LowerDevice == NULL)
-    {
-        DPRINT1("UsbEhci: Failed to attach to device stack!\n");
-        IoDeleteSymbolicLink(&SymLinkName);
-        IoDeleteDevice(Fdo);
-
-        return STATUS_NO_SUCH_DEVICE;
-    }
-
-    Fdo->Flags |= DO_BUFFERED_IO;// | DO_POWER_PAGABLE;
-
-    ASSERT(FdoDeviceExtension->LowerDevice == Pdo);
-
-    /* Get the EHCI Device ID and Vendor ID */
-    Status = GetBusInterface(FdoDeviceExtension->LowerDevice, &FdoDeviceExtension->BusInterface);
-
-    if (!NT_SUCCESS(Status))
-    {
-        DPRINT1("GetBusInterface() failed with %x\n", Status);
-        IoDetachDevice(FdoDeviceExtension->LowerDevice);
-        IoDeleteSymbolicLink(&SymLinkName);
-        IoDeleteDevice(Fdo);
-        return Status;
-    }
-
-    BytesRead = (*FdoDeviceExtension->BusInterface.GetBusData)(
-        FdoDeviceExtension->BusInterface.Context,
-        PCI_WHICHSPACE_CONFIG,
-        &PciConfig,
-        0,
-        PCI_COMMON_HDR_LENGTH);
-
-
-    if (BytesRead != PCI_COMMON_HDR_LENGTH)
-    {
-        DPRINT1("GetBusData failed!\n");
-        IoDetachDevice(FdoDeviceExtension->LowerDevice);
-        IoDeleteSymbolicLink(&SymLinkName);
-        IoDeleteDevice(Fdo);
-        return STATUS_UNSUCCESSFUL;
-    }
-
-    if (PciConfig.Command & PCI_ENABLE_IO_SPACE)
-        DPRINT("PCI_ENABLE_IO_SPACE\n");
-
-    if (PciConfig.Command & PCI_ENABLE_MEMORY_SPACE)
-        DPRINT("PCI_ENABLE_MEMORY_SPACE\n");
-
-    if (PciConfig.Command & PCI_ENABLE_BUS_MASTER)
-        DPRINT("PCI_ENABLE_BUS_MASTER\n");
-
-    DPRINT("BaseAddress[0] %x\n", PciConfig.u.type0.BaseAddresses[0]);
-    DPRINT1("Vendor %x\n", PciConfig.VendorID);
-    DPRINT1("Device %x\n", PciConfig.DeviceID);
-
-    FdoDeviceExtension->VendorId = PciConfig.VendorID;
-    FdoDeviceExtension->DeviceId = PciConfig.DeviceID;
-
-    FdoDeviceExtension->DeviceState = DEVICEINTIALIZED;
-
-    Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_USB_HOST_CONTROLLER, NULL, &InterfaceSymLinkName);
-    if (!NT_SUCCESS(Status))
-    {
-        DPRINT1("Unable to register device interface!\n");
-        return Status;
-    }
-    else
-    {
-        Status = IoSetDeviceInterfaceState(&InterfaceSymLinkName, TRUE);
-        DPRINT1("SetInterfaceState %x\n", Status);
-        if (!NT_SUCCESS(Status))
-            return Status;
-    }
-    Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
-
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS NTAPI
-FdoDispatchInternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
-    /*FIXME: This should never be called by upper drivers as they should only be dealing with the pdo. */
-    DPRINT1("Upper Level Device Object shouldnt be calling this!!!!!!!!!!!!\n");
-    ASSERT(FALSE);
-    return STATUS_UNSUCCESSFUL;
-}
diff --git a/drivers/usb/usbehci/hardware.c b/drivers/usb/usbehci/hardware.c
deleted file mode 100644 (file)
index 8e9c6d5..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * PROJECT:     ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        drivers/usb/usbehci/hardware.c
- * PURPOSE:     Hardware related routines.
- * PROGRAMMERS:
- *              Michael Martin (michael.martin@reactos.org)
- */
-
-#include "hardware.h"
-#define NDEBUG
-#include <debug.h>
-
-//FORCEINLINE
-VOID
-SetAsyncListQueueRegister(PEHCI_HOST_CONTROLLER hcd, ULONG PhysicalAddr)
-{   
-    ULONG OpRegisters = hcd->OpRegisters;
-    WRITE_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_ASYNCLISTBASE), PhysicalAddr);
-}
-
-//FORCEINLINE
-ULONG
-GetAsyncListQueueRegister(PEHCI_HOST_CONTROLLER hcd)
-{
-    ULONG OpRegisters = hcd->OpRegisters;
-    return READ_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_ASYNCLISTBASE));
-}
-
-//FORCEINLINE
-VOID
-SetPeriodicFrameListRegister(PEHCI_HOST_CONTROLLER hcd, ULONG PhysicalAddr)
-{
-    ULONG OpRegisters = hcd->OpRegisters;
-    WRITE_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_PERIODICLISTBASE), PhysicalAddr);
-}
-
-//FORCEINLINE
-ULONG
-GetPeriodicFrameListRegister(PEHCI_HOST_CONTROLLER hcd)
-{
-    ULONG OpRegisters = hcd->OpRegisters;
-    return READ_REGISTER_ULONG((PULONG) (OpRegisters + EHCI_PERIODICLISTBASE));
-}
-
-//FORCEINLINE
-ULONG
-ReadControllerStatus(PEHCI_HOST_CONTROLLER hcd)
-{
-    ULONG OpRegisters = hcd->OpRegisters;
-    return READ_REGISTER_ULONG ((PULONG) (OpRegisters + EHCI_USBSTS));
-}
-
-//FORCEINLINE
-VOID
-ClearControllerStatus(PEHCI_HOST_CONTROLLER hcd, ULONG Status)
-{
-    ULONG OpRegisters = hcd->OpRegisters;
-    WRITE_REGISTER_ULONG((PULONG) (OpRegisters + EHCI_USBSTS), Status);
-}
-
-VOID
-ResetPort(PEHCI_HOST_CONTROLLER hcd, UCHAR Port)
-{
-    ULONG tmp;
-    ULONG OpRegisters = hcd->OpRegisters;
-    DPRINT("Reset Port %x\n", Port);
-
-    tmp = READ_REGISTER_ULONG((PULONG) ((OpRegisters + EHCI_PORTSC) + (4 * Port)));
-    if (tmp & 0x400)
-    {
-        DPRINT1("Non HighSpeed device connected. Releasing ownership.\n");
-        WRITE_REGISTER_ULONG((PULONG) ((OpRegisters + EHCI_PORTSC) + (4 * Port)), 0x2000);
-    }
-
-    /* Get current port state */
-    tmp = READ_REGISTER_ULONG((PULONG) ((OpRegisters + EHCI_PORTSC) + (4 * Port)));
-
-    /* Set reset and clear enable */
-    tmp |= 0x100;
-    tmp &= ~0x04;
-    WRITE_REGISTER_ULONG((PULONG) ((OpRegisters + EHCI_PORTSC) + (4 * Port)), tmp);
-
-    /* USB 2.0 Spec 10.2.8.1, more than 50ms */
-    KeStallExecutionProcessor(100);
-
-    /* Clear reset */
-    tmp &= ~0x100;
-    WRITE_REGISTER_ULONG((PULONG) ((OpRegisters + EHCI_PORTSC) + (4 * Port)), tmp);
-
-    KeStallExecutionProcessor(100);
-
-    tmp = READ_REGISTER_ULONG((PULONG) ((OpRegisters + EHCI_PORTSC) + (4 * Port)));
-
-    if (tmp & 0x100)
-    {
-        DPRINT1("EHCI ERROR: Port Reset did not complete!\n");
-        ASSERT(FALSE);
-    }
-    DPRINT("Reset complete\n");
-}
-
-VOID
-StopEhci(PEHCI_HOST_CONTROLLER hcd)
-{
-    ULONG OpRegisters = hcd->OpRegisters;
-    PEHCI_USBCMD_CONTENT UsbCmd;
-    PEHCI_USBSTS_CONTEXT UsbSts;
-    LONG FailSafe;
-    LONG tmp;
-
-    DPRINT("Stopping Ehci controller\n");
-
-    WRITE_REGISTER_ULONG((PULONG) (OpRegisters + EHCI_USBINTR), 0);
-
-    tmp = READ_REGISTER_ULONG((PULONG) (OpRegisters + EHCI_USBCMD));
-    UsbCmd = (PEHCI_USBCMD_CONTENT) & tmp;
-    UsbCmd->Run = FALSE;
-    WRITE_REGISTER_ULONG((PULONG) (OpRegisters + EHCI_USBCMD), tmp);
-
-    /* Wait for the device to stop */
-    for (FailSafe = 0; FailSafe < 1000; FailSafe++)
-    {
-        KeStallExecutionProcessor(10);
-        tmp = READ_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_USBSTS));
-        UsbSts = (PEHCI_USBSTS_CONTEXT)&tmp;
-
-        if (UsbSts->HCHalted)
-        {
-            break;
-        }
-    }
-    if (!UsbSts->HCHalted)
-    {
-        DPRINT1("EHCI ERROR: Controller is not responding to Stop request!\n");
-        ASSERT(FALSE);
-    }
-}
-
-VOID
-StartEhci(PEHCI_HOST_CONTROLLER hcd)
-{
-    ULONG OpRegisters = hcd->OpRegisters;
-    PEHCI_USBCMD_CONTENT UsbCmd;
-    PEHCI_USBSTS_CONTEXT UsbSts;
-    LONG failSafe;
-    LONG tmp;
-    LONG tmp2;
-
-    DPRINT("Starting Ehci controller\n");
-
-    tmp = READ_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_USBSTS));
-    UsbSts = (PEHCI_USBSTS_CONTEXT)&tmp;
-
-    if (!UsbSts->HCHalted)
-    {
-        StopEhci(hcd);
-    }
-
-    tmp = READ_REGISTER_ULONG ((PULONG)(OpRegisters + EHCI_USBCMD));
-
-    /* Reset the device */
-    UsbCmd = (PEHCI_USBCMD_CONTENT) &tmp;
-    UsbCmd->HCReset = TRUE;
-    WRITE_REGISTER_ULONG ((PULONG)(OpRegisters + EHCI_USBCMD), tmp);
-
-    /* Wait for the device to reset */
-    for (failSafe = 0; failSafe < 1000; failSafe++)
-    {
-        KeStallExecutionProcessor(10);
-        tmp = READ_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_USBCMD));
-        UsbCmd = (PEHCI_USBCMD_CONTENT)&tmp;
-
-        if (!UsbCmd->HCReset)
-        {
-            break;
-        }
-        DPRINT("Waiting for reset, USBCMD: %x\n", READ_REGISTER_ULONG ((PULONG)(OpRegisters + EHCI_USBCMD)));
-    }
-
-    if (UsbCmd->HCReset)
-    {
-        DPRINT1("EHCI ERROR: Controller failed to reset! Will attempt to continue.\n");
-        ASSERT(FALSE);
-    }
-
-    UsbCmd = (PEHCI_USBCMD_CONTENT) &tmp;
-
-    /* Disable Interrupts on the device */
-    WRITE_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_USBINTR), 0);
-    /* Clear the Status */
-    WRITE_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_USBSTS), 0x0000001f);
-
-    WRITE_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_CTRLDSSEGMENT), 0);
-
-    SetAsyncListQueueRegister(hcd, hcd->AsyncListQueue->PhysicalAddr | QH_TYPE_QH);
-    /* Set the ansync and periodic to disable */
-    UsbCmd->PeriodicEnable = FALSE;
-    UsbCmd->AsyncEnable = TRUE;
-    WRITE_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_USBCMD), tmp);
-
-    /* Set the threshold */
-    UsbCmd->IntThreshold = 1;
-    WRITE_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_USBCMD), tmp);
-
-    /* Turn back on interrupts */
-    WRITE_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_USBINTR),
-                        EHCI_USBINTR_ERR | EHCI_USBINTR_ASYNC | EHCI_USBINTR_HSERR
-                        /*| EHCI_USBINTR_FLROVR*/  | EHCI_USBINTR_PC);
-    WRITE_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_USBINTR),
-                        EHCI_USBINTR_INTE | EHCI_USBINTR_ERR | EHCI_USBINTR_ASYNC | EHCI_USBINTR_HSERR
-                        /*| EHCI_USBINTR_FLROVR*/  | EHCI_USBINTR_PC);
-
-    UsbCmd->Run = TRUE;
-    WRITE_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_USBCMD), tmp);
-
-    /* Wait for the device to start */
-    for (failSafe = 0; failSafe < 1000; failSafe++)
-    {
-        KeStallExecutionProcessor(10);
-        tmp2 = READ_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_USBSTS));
-        UsbSts = (PEHCI_USBSTS_CONTEXT)&tmp2;
-
-        if (!UsbSts->HCHalted)
-        {
-            break;
-        }
-        DPRINT("Waiting for start, USBSTS: %x\n", READ_REGISTER_ULONG ((PULONG)(OpRegisters + EHCI_USBSTS)));
-    }
-
-    if (UsbSts->HCHalted)
-    {
-        DPRINT1("EHCI ERROR: Controller failed to start!!!\n");
-        ASSERT(FALSE);
-    }
-    /* Set all port routing to ECHI controller */
-    WRITE_REGISTER_ULONG((PULONG)(OpRegisters + EHCI_CONFIGFLAG), 1);
-}
-
-BOOLEAN
-EnumControllerPorts(PEHCI_HOST_CONTROLLER hcd)
-{
-    ULONG tmp, i, OpRegisters, ChildDeviceCount = 0;
-    BOOLEAN PortChange = FALSE;
-
-    OpRegisters = (ULONG)hcd->OpRegisters;
-    /* Loop through the ports */
-    for (i = 0; i < hcd->ECHICaps.HCSParams.PortCount; i++)
-    {
-        tmp = READ_REGISTER_ULONG((PULONG) ((OpRegisters + EHCI_PORTSC) + (4 * i)));
-
-        /* Check for port change on this port */
-        if (tmp & 0x02)
-        {
-            DPRINT1("Port Change\n");
-
-            /* Clear status change */
-            tmp = READ_REGISTER_ULONG((PULONG)((OpRegisters + EHCI_PORTSC) + (4 * i)));
-            tmp |= 0x02;
-            WRITE_REGISTER_ULONG((PULONG) ((OpRegisters + EHCI_PORTSC) + (4 * i)), tmp);
-            
-            PortChange = TRUE;
-            /* Connect or Disconnect? */
-            if (tmp & 0x01)
-            {
-                DPRINT1("Device connected on port %d\n", i);
-
-                /* Check if a companion host controller exists */
-                if (hcd->ECHICaps.HCSParams.CHCCount)
-                {
-                    tmp = READ_REGISTER_ULONG((PULONG)((OpRegisters + EHCI_PORTSC) + (4 * i)));
-
-                    /* Port should be in disabled state, as per USB 2.0 specs */
-                    if (tmp & 0x04)
-                    {
-                        DPRINT1("Warning: The port the device has just connected to is not disabled!\n");
-                    }
-
-                    /* Is this non high speed device */
-                    if (tmp & 0x400)
-                    {
-                        DPRINT1("Non HighSpeed device connected. Releasing ownership.\n");
-                        /* Release ownership to companion host controller */
-                        WRITE_REGISTER_ULONG((PULONG) ((OpRegisters + EHCI_PORTSC) + (4 * i)), 0x2000);
-                        continue;
-                    }
-                }
-
-                KeStallExecutionProcessor(30);
-
-                /* As per USB 2.0 Specs, 9.1.2. Reset the port and clear the status change */
-                //tmp |= 0x100 | 0x02;
-                /* Sanity, Disable port */
-                //tmp &= ~0x04;
-
-                //WRITE_REGISTER_ULONG((PULONG) ((Base + EHCI_PORTSC) + (4 * i)), tmp);
-
-                //KeStallExecutionProcessor(20);
-
-                tmp = READ_REGISTER_ULONG((PULONG)((OpRegisters + EHCI_PORTSC) + (4 * i)));
-
-                ChildDeviceCount++;
-                hcd->Ports[i].PortStatus &= ~0x8000;
-                DPRINT1("Removed 0x8000\n");
-                ASSERT(FALSE);
-                hcd->Ports[i].PortStatus |= USB_PORT_STATUS_HIGH_SPEED;
-                hcd->Ports[i].PortStatus |= USB_PORT_STATUS_CONNECT;
-                hcd->Ports[i].PortChange |= USB_PORT_STATUS_CONNECT;
-            }
-            else
-            {
-                DPRINT1("Device disconnected on port %d\n", i);
-                ChildDeviceCount--;
-            }
-        }
-    }
-    return PortChange;
-}
-
-VOID
-GetCapabilities(PEHCI_CAPS PCap, ULONG CapRegister)
-{
-    PEHCI_HCS_CONTENT PHCS;
-    LONG i;
-
-    if (!PCap)
-        return;
-
-    PCap->Length = READ_REGISTER_UCHAR((PUCHAR)CapRegister);
-    PCap->Reserved = READ_REGISTER_UCHAR((PUCHAR)(CapRegister + 1));
-    PCap->HCIVersion = READ_REGISTER_USHORT((PUSHORT)(CapRegister + 2));
-    PCap->HCSParamsLong = READ_REGISTER_ULONG((PULONG)(CapRegister + 4));
-    PCap->HCCParams = READ_REGISTER_ULONG((PULONG)(CapRegister + 8));
-
-    DPRINT("Length %d\n", PCap->Length);
-    DPRINT("Reserved %d\n", PCap->Reserved);
-    DPRINT("HCIVersion %x\n", PCap->HCIVersion);
-    DPRINT("HCSParams %x\n", PCap->HCSParamsLong);
-    DPRINT("HCCParams %x\n", PCap->HCCParams);
-
-    if (PCap->HCCParams & 0x02)
-        DPRINT1("Frame list size is configurable\n");
-
-    if (PCap->HCCParams & 0x01)
-        DPRINT1("64bit address mode not supported!\n");
-
-    DPRINT1("Number of Ports: %d\n", PCap->HCSParams.PortCount);
-
-    if (PCap->HCSParams.PortPowerControl)
-        DPRINT1("Port Power Control is enabled\n");
-
-    if (!PCap->HCSParams.CHCCount)
-    {
-        DPRINT1("Number of Companion Host controllers %x\n", PCap->HCSParams.CHCCount);
-        DPRINT1("Number of Ports Per CHC: %d\n", PCap->HCSParams.PortPerCHC);
-    }
-
-    PHCS = (PEHCI_HCS_CONTENT)&PCap->HCSParams;
-    if (PHCS->PortRouteRules)
-    {
-        for (i = 0; i < PCap->HCSParams.PortCount; i++)
-        {
-            PCap->PortRoute[i] = READ_REGISTER_UCHAR((PUCHAR) (CapRegister + 12 + i));
-        }
-    }
-}
diff --git a/drivers/usb/usbehci/hwiface.c b/drivers/usb/usbehci/hwiface.c
deleted file mode 100644 (file)
index aae5157..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * PROJECT:     ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        drivers/usb/usbehci/hwiface.c
- * PURPOSE:     EHCI Interface routines: Queue Heads and Queue Element
-                Transfer Descriptors.
- * TODO:        Periodic Frame List, Isochronous Transaction Descriptors
-                and Split-transaction ITD.
- * PROGRAMMERS:
- *              Michael Martin (michael.martin@reactos.org)
- */
-
-#include "hwiface.h"
-#include "physmem.h"
-#define NDEBUG
-#include <debug.h>
-
-/* Queue Element Transfer Descriptors */
-
-PQUEUE_TRANSFER_DESCRIPTOR
-CreateDescriptor(PEHCI_HOST_CONTROLLER hcd, UCHAR PIDCode, ULONG TotalBytesToTransfer)
-{
-    PQUEUE_TRANSFER_DESCRIPTOR Descriptor;
-    ULONG PhysicalAddress;
-    UCHAR i;
-    KIRQL OldIrql;
-
-    KeAcquireSpinLock(&hcd->Lock, &OldIrql);
-
-    Descriptor = (PQUEUE_TRANSFER_DESCRIPTOR)AllocateMemory(hcd, sizeof(QUEUE_TRANSFER_DESCRIPTOR), &PhysicalAddress);
-    RtlZeroMemory(Descriptor, sizeof(QUEUE_TRANSFER_DESCRIPTOR));
-    Descriptor->NextPointer = TERMINATE_POINTER;
-    Descriptor->AlternateNextPointer = TERMINATE_POINTER;
-    Descriptor->Token.Bits.DataToggle = TRUE;
-    Descriptor->Token.Bits.ErrorCounter = 0x03;
-    Descriptor->Token.Bits.Active = TRUE;
-    Descriptor->Token.Bits.PIDCode = PIDCode;
-    Descriptor->Token.Bits.TotalBytesToTransfer = TotalBytesToTransfer;
-    Descriptor->PhysicalAddr = PhysicalAddress;
-    for (i=0;i<5;i++)
-        Descriptor->BufferPointer[i] = 0;
-
-    KeReleaseSpinLock(&hcd->Lock, OldIrql);
-
-    return Descriptor;
-}
-
-VOID
-FreeDescriptor(PEHCI_HOST_CONTROLLER hcd, PQUEUE_TRANSFER_DESCRIPTOR Descriptor)
-{
-    ReleaseMemory(hcd, (ULONG)Descriptor);
-}
-
-/* Queue Head */
-
-VOID
-DumpQueueHeadList(PEHCI_HOST_CONTROLLER hcd)
-{
-    KIRQL OldIrql;
-
-    KeAcquireSpinLock(&hcd->Lock, &OldIrql);
-
-    PQUEUE_HEAD QueueHead = (PQUEUE_HEAD)hcd->CommonBufferVA;
-    PQUEUE_HEAD FirstQueueHead = QueueHead;
-    DPRINT1("Dumping QueueHead List!!!!!!!!!!!!!\n");
-    while (1)
-    {
-        DPRINT1("QueueHead Address %x\n", QueueHead);
-        DPRINT1("QueueHead->PreviousQueueHead = %x\n", QueueHead->PreviousQueueHead);
-        DPRINT1("QueueHead->NextQueueHead = %x\n", QueueHead->NextQueueHead);
-        DPRINT1(" ---> PhysicalAddress %x\n", (ULONG)MmGetPhysicalAddress(QueueHead).LowPart);
-        DPRINT1("QueueHead->HorizontalLinkPointer %x\n", QueueHead->HorizontalLinkPointer);
-        QueueHead = QueueHead->NextQueueHead;
-        DPRINT1("Next QueueHead %x\n", QueueHead);
-        if (QueueHead == FirstQueueHead) break;
-    }
-    DPRINT1("-----------------------------------\n");
-    KeReleaseSpinLock(&hcd->Lock, OldIrql);
-}
-
-PQUEUE_HEAD
-CreateQueueHead(PEHCI_HOST_CONTROLLER hcd)
-{
-    PQUEUE_HEAD CurrentQH;
-    ULONG PhysicalAddress , i;
-    KIRQL OldIrql;
-
-    KeAcquireSpinLock(&hcd->Lock, &OldIrql);
-    CurrentQH = (PQUEUE_HEAD)AllocateMemory(hcd, sizeof(QUEUE_HEAD), &PhysicalAddress);
-    RtlZeroMemory(CurrentQH, sizeof(QUEUE_HEAD));
-
-    ASSERT(CurrentQH);
-    CurrentQH->PhysicalAddr = PhysicalAddress;
-    CurrentQH->HorizontalLinkPointer = TERMINATE_POINTER;
-    CurrentQH->AlternateNextPointer = TERMINATE_POINTER;
-    CurrentQH->NextPointer = TERMINATE_POINTER;
-
-    /* 1 for non high speed, 0 for high speed device */
-    CurrentQH->EndPointCharacteristics.ControlEndPointFlag = 0;
-    CurrentQH->EndPointCharacteristics.HeadOfReclamation = FALSE;
-    CurrentQH->EndPointCharacteristics.MaximumPacketLength = 64;
-
-    /* Set NakCountReload to max value possible */
-    CurrentQH->EndPointCharacteristics.NakCountReload = 0xF;
-
-    /* Get the Initial Data Toggle from the QEDT */
-    CurrentQH->EndPointCharacteristics.QEDTDataToggleControl = FALSE;
-
-    /* High Speed Device */
-    CurrentQH->EndPointCharacteristics.EndPointSpeed = QH_ENDPOINT_HIGHSPEED;
-
-    CurrentQH->EndPointCapabilities.NumberOfTransactionPerFrame = 0x03;
-
-    CurrentQH->Token.DWord = 0;
-    CurrentQH->NextQueueHead = NULL;
-    CurrentQH->PreviousQueueHead = NULL;
-    for (i=0; i<5; i++)
-        CurrentQH->BufferPointer[i] = 0;
-
-    CurrentQH->Token.Bits.InterruptOnComplete = FALSE;
-
-    KeReleaseSpinLock(&hcd->Lock, OldIrql);
-    return CurrentQH;
-}
-
-VOID
-LinkQueueHead(PEHCI_HOST_CONTROLLER hcd, PQUEUE_HEAD QueueHead)
-{
-    KIRQL OldIrql;
-    PQUEUE_HEAD CurrentHead  = (PQUEUE_HEAD)hcd->AsyncListQueue;
-    PQUEUE_HEAD PreviousHead;
-
-    KeAcquireSpinLock(&hcd->Lock, &OldIrql);
-    PreviousHead = CurrentHead->PreviousQueueHead;
-    QueueHead->NextQueueHead = CurrentHead;
-    QueueHead->PreviousQueueHead = PreviousHead;
-    PreviousHead->NextQueueHead = QueueHead;
-    CurrentHead->PreviousQueueHead = QueueHead;
-    
-    QueueHead->HorizontalLinkPointer = (CurrentHead->HorizontalLinkPointer | QH_TYPE_QH) & ~TERMINATE_POINTER;
-    PreviousHead->HorizontalLinkPointer = QueueHead->PhysicalAddr| QH_TYPE_QH;
-
-    KeReleaseSpinLock(&hcd->Lock, OldIrql);
-}
-
-VOID
-UnlinkQueueHead(PEHCI_HOST_CONTROLLER hcd, PQUEUE_HEAD QueueHead)
-{
-    KIRQL OldIrql;
-    PQUEUE_HEAD PreviousHead;
-    PQUEUE_HEAD NextHead;
-    KeAcquireSpinLock(&hcd->Lock, &OldIrql);
-
-    PreviousHead = QueueHead->PreviousQueueHead;
-    NextHead = QueueHead->NextQueueHead;
-
-    PreviousHead->NextQueueHead = NextHead;
-    NextHead->PreviousQueueHead = PreviousHead;
-
-    PreviousHead->HorizontalLinkPointer = NextHead->HorizontalLinkPointer;
-    KeReleaseSpinLock(&hcd->Lock, OldIrql);
-}
-
-VOID
-LinkQueueHeadToCompletedList(PEHCI_HOST_CONTROLLER hcd, PQUEUE_HEAD QueueHead)
-{
-    KIRQL OldIrql;
-    PQUEUE_HEAD CurrentHead  = (PQUEUE_HEAD)hcd->CompletedListQueue;
-    PQUEUE_HEAD PreviousHead;
-
-    KeAcquireSpinLock(&hcd->Lock, &OldIrql);
-        
-    PreviousHead = CurrentHead->PreviousQueueHead;
-    QueueHead->NextQueueHead = CurrentHead;
-    QueueHead->PreviousQueueHead = PreviousHead;
-    PreviousHead->NextQueueHead = QueueHead;
-    CurrentHead->PreviousQueueHead = QueueHead;
-
-    KeReleaseSpinLock(&hcd->Lock, OldIrql);
-
-}
-
-VOID
-DeleteQueueHead(PEHCI_HOST_CONTROLLER hcd, PQUEUE_HEAD QueueHead)
-{
-    ReleaseMemory(hcd, (ULONG)QueueHead);
-}
-
-VOID
-CleanupAsyncList(PEHCI_HOST_CONTROLLER hcd)
-{
-    PQUEUE_TRANSFER_DESCRIPTOR Descriptor;
-    PQUEUE_HEAD QueueHead;
-    KIRQL OldIrql;
-
-    KeAcquireSpinLock(&hcd->Lock, &OldIrql);
-
-    QueueHead = hcd->CompletedListQueue;
-    QueueHead = QueueHead->NextQueueHead;
-
-    while (QueueHead != hcd->CompletedListQueue)
-    {
-        Descriptor = QueueHead->FirstTransferDescriptor;
-        while (Descriptor)
-        {
-            if (Descriptor->Token.Bits.PIDCode == PID_CODE_SETUP_TOKEN)
-                ReleaseMemory(hcd, Descriptor->BufferPointerVA[0]);
-            FreeDescriptor(hcd, Descriptor);
-            Descriptor = Descriptor->NextDescriptor;
-        }
-
-        if (QueueHead->FreeMdl)
-        {
-            DPRINT("Freeing Mdl %x, StartVA %x\n", QueueHead->Mdl, QueueHead->Mdl->StartVa);
-            IoFreeMdl(QueueHead->Mdl);
-        }
-        
-        QueueHead = QueueHead->NextQueueHead;
-    }
-    
-    hcd->CompletedListQueue->NextQueueHead = hcd->CompletedListQueue;
-    hcd->CompletedListQueue->PreviousQueueHead = hcd->CompletedListQueue;
-    
-    KeReleaseSpinLock(&hcd->Lock, OldIrql);
-}
-
diff --git a/drivers/usb/usbehci/hwiface.h b/drivers/usb/usbehci/hwiface.h
deleted file mode 100644 (file)
index aa961e6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "hardware.h"
-#include <ntddk.h>
-
-PQUEUE_TRANSFER_DESCRIPTOR
-CreateDescriptor(PEHCI_HOST_CONTROLLER hcd, UCHAR PIDCode, ULONG TotalBytesToTransfer);
-
-VOID
-FreeDescriptor(PEHCI_HOST_CONTROLLER hcd, PQUEUE_TRANSFER_DESCRIPTOR Descriptor);
-
-VOID
-DumpQueueHeadList(PEHCI_HOST_CONTROLLER hcd);
-
-PQUEUE_HEAD
-CreateQueueHead(PEHCI_HOST_CONTROLLER hcd);
-
-VOID
-LinkQueueHead(PEHCI_HOST_CONTROLLER hcd, PQUEUE_HEAD QueueHead);
-
-VOID
-UnlinkQueueHead(PEHCI_HOST_CONTROLLER hcd, PQUEUE_HEAD QueueHead);
-
-VOID
-DeleteQueueHead(PEHCI_HOST_CONTROLLER hcd, PQUEUE_HEAD QueueHead);
-
-VOID
-LinkQueueHeadToCompletedList(PEHCI_HOST_CONTROLLER hcd, PQUEUE_HEAD QueueHead);
-
-VOID
-CleanupAsyncList(PEHCI_HOST_CONTROLLER hcd);
diff --git a/drivers/usb/usbehci/irp.c b/drivers/usb/usbehci/irp.c
deleted file mode 100644 (file)
index 605041f..0000000
+++ /dev/null
@@ -1,767 +0,0 @@
-/*
- * PROJECT:     ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        drivers/usb/usbehci/irp.c
- * PURPOSE:     IRP Handling.
- * PROGRAMMERS:
- *              Michael Martin (michael.martin@reactos.org)
- */
-
-#include "usbehci.h"
-#include "hwiface.h"
-#include "physmem.h"
-#include "transfer.h"
-
-VOID NTAPI
-WorkerThread(IN PVOID Context)
-{
-    PWORKITEMDATA WorkItemData = (PWORKITEMDATA)Context;
-    
-    CompletePendingURBRequest((PPDO_DEVICE_EXTENSION)WorkItemData->Context);
-    
-    ExFreePool(WorkItemData);
-}
-
-VOID
-RemoveUrbRequest(PPDO_DEVICE_EXTENSION DeviceExtension, PIRP Irp)
-{
-    KIRQL OldIrql;
-    KeAcquireSpinLock(&DeviceExtension->IrpQueueLock, &OldIrql);
-    RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
-    KeReleaseSpinLock(&DeviceExtension->IrpQueueLock, OldIrql);
-}
-
-VOID
-RequestURBCancel (PPDO_DEVICE_EXTENSION PdoDeviceExtension, PIRP Irp)
-{
-    KIRQL OldIrql = Irp->CancelIrql;
-    IoReleaseCancelSpinLock(DISPATCH_LEVEL);
-    DPRINT1("IRP CANCELLED\n");
-    ASSERT(FALSE);
-    KeAcquireSpinLockAtDpcLevel(&PdoDeviceExtension->IrpQueueLock);
-    RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
-
-    KeReleaseSpinLock(&PdoDeviceExtension->IrpQueueLock, OldIrql);
-
-    Irp->IoStatus.Status = STATUS_CANCELLED;
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-}
-
-VOID
-QueueURBRequest(PPDO_DEVICE_EXTENSION DeviceExtension, PIRP Irp)
-{
-    KIRQL OldIrql;
-
-    KeAcquireSpinLock(&DeviceExtension->IrpQueueLock, &OldIrql);
-
-    if ((Irp->Cancel) && (IoSetCancelRoutine(Irp, RequestURBCancel)))
-    {
-        KeReleaseSpinLock(&DeviceExtension->IrpQueueLock, OldIrql);
-        Irp->IoStatus.Status = STATUS_CANCELLED;
-        IoCompleteRequest(Irp, IO_NO_INCREMENT);
-    }
-    else
-    {
-        InsertTailList(&DeviceExtension->IrpQueue, &Irp->Tail.Overlay.ListEntry);
-        KeReleaseSpinLock(&DeviceExtension->IrpQueueLock, OldIrql);
-    }
-}
-
-NTSTATUS HandleUrbRequest(PPDO_DEVICE_EXTENSION PdoDeviceExtension, PIRP Irp)
-{
-    NTSTATUS Status = STATUS_UNSUCCESSFUL;
-    USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup;
-    ULONG_PTR Information = 0;
-    PIO_STACK_LOCATION Stack;
-    PUSB_DEVICE UsbDevice = NULL;
-    PEHCI_HOST_CONTROLLER hcd;
-    URB *Urb;
-    PFDO_DEVICE_EXTENSION FdoDeviceExtension;
-    FdoDeviceExtension = (PFDO_DEVICE_EXTENSION) PdoDeviceExtension->ControllerFdo->DeviceExtension;
-
-    hcd = &FdoDeviceExtension->hcd;
-
-    Stack = IoGetCurrentIrpStackLocation(Irp);
-    ASSERT(Stack);
-
-    Urb = (PURB) Stack->Parameters.Others.Argument1;
-    ASSERT(Urb);
-
-    Information = 0;
-    Status = STATUS_SUCCESS;
-
-    DPRINT("TransferBuffer %x\n", Urb->UrbControlDescriptorRequest.TransferBuffer);
-    DPRINT("TransferBufferLength %x\n", Urb->UrbControlDescriptorRequest.TransferBufferLength);
-    DPRINT("UsbdDeviceHandle = %x\n", Urb->UrbHeader.UsbdDeviceHandle);
-
-    UsbDevice = Urb->UrbHeader.UsbdDeviceHandle;
-
-    /* UsbdDeviceHandle of 0 is root hub */
-    if (UsbDevice == NULL)
-        UsbDevice = PdoDeviceExtension->UsbDevices[0];
-
-    /* Assume URB success */
-    Urb->UrbHeader.Status = USBD_STATUS_SUCCESS;
-    /* Set the DeviceHandle to the Internal Device */
-    Urb->UrbHeader.UsbdDeviceHandle = UsbDevice;
-
-    switch (Urb->UrbHeader.Function)
-    {
-        case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
-        {
-            PUSB_ENDPOINT_DESCRIPTOR EndPointDesc;
-            int i;
-            
-            for (i = 0; i < UsbDevice->ActiveInterface->InterfaceDescriptor.bNumEndpoints; i++)
-            {
-                EndPointDesc = (PUSB_ENDPOINT_DESCRIPTOR)&UsbDevice->ActiveInterface->EndPoints[i]->EndPointDescriptor;
-                DPRINT("EndPoint %d Handle %x\n", i, &UsbDevice->ActiveInterface->EndPoints[i]->EndPointDescriptor);
-                DPRINT("bmAttributes %x\n", EndPointDesc->bmAttributes);
-                DPRINT("EndPoint is transfer type %x\n", EndPointDesc->bmAttributes & 0x0F);
-            }
-            DPRINT("UsbDevice %x, Handle %x\n", UsbDevice, Urb->UrbBulkOrInterruptTransfer.PipeHandle);
-            if (&UsbDevice->ActiveInterface->EndPoints[0]->EndPointDescriptor != Urb->UrbBulkOrInterruptTransfer.PipeHandle)
-            {
-                DPRINT("HubDevice %x, UsbDevice %x\n", PdoDeviceExtension->UsbDevices[0], UsbDevice);
-                if (Urb->UrbBulkOrInterruptTransfer.TransferFlags & USBD_TRANSFER_DIRECTION_IN)
-                    DPRINT1("USBD_TRANSFER_DIRECTION_IN\n");
-                if (Urb->UrbBulkOrInterruptTransfer.TransferFlags & USBD_TRANSFER_DIRECTION_OUT)
-                    DPRINT1("USBD_TRANSFER_DIRECTION_OUT\n");
-                if (Urb->UrbBulkOrInterruptTransfer.TransferFlags & USBD_SHORT_TRANSFER_OK)
-                    DPRINT1("USBD_SHORT_TRANSFER_OK\n");
-                EndPointDesc = (PUSB_ENDPOINT_DESCRIPTOR)Urb->UrbBulkOrInterruptTransfer.PipeHandle;
-                DPRINT("EndPoint is transfer type %x\n", EndPointDesc->bmAttributes & 0x0F);
-                DPRINT("Endpoint Address %x\n", EndPointDesc->bEndpointAddress & 0x0F);
-                if ((EndPointDesc->bmAttributes & 0x0F) == USB_ENDPOINT_TYPE_BULK)
-                {
-                    IoMarkIrpPending(Irp);
-                    Status = STATUS_PENDING;
-
-                    ExecuteTransfer(FdoDeviceExtension->DeviceObject,
-                                    UsbDevice,
-                                    Urb->UrbBulkOrInterruptTransfer.PipeHandle,
-                                    NULL,
-                                    Urb->UrbBulkOrInterruptTransfer.TransferFlags,
-                                    Urb->UrbBulkOrInterruptTransfer.TransferBuffer ?
-                                        Urb->UrbBulkOrInterruptTransfer.TransferBuffer : 
-                                        (PVOID)Urb->UrbBulkOrInterruptTransfer.TransferBufferMDL,
-                                    Urb->UrbBulkOrInterruptTransfer.TransferBuffer ?
-                                        Urb->UrbBulkOrInterruptTransfer.TransferBufferLength : 0,
-                                    Irp);
-                }
-                else
-                {
-                    DPRINT1("Transfer Type not implemented yet!\n");
-                    /* FAKE IT */
-                    Status = STATUS_SUCCESS;
-                }
-
-                break;
-            }
-            if (!Urb->UrbBulkOrInterruptTransfer.TransferBuffer)
-            {
-                DPRINT1("TransferBuffer is NULL!\n");
-                ASSERT(FALSE);
-                break;
-            }
-
-            RtlZeroMemory(Urb->UrbBulkOrInterruptTransfer.TransferBuffer, Urb->UrbBulkOrInterruptTransfer.TransferBufferLength);
-
-            if (UsbDevice == PdoDeviceExtension->UsbDevices[0])
-            {
-                if (Urb->UrbBulkOrInterruptTransfer.TransferFlags & (USBD_TRANSFER_DIRECTION_IN | USBD_SHORT_TRANSFER_OK))
-                {
-                    LONG i;
-                    for (i = 0; i < hcd->ECHICaps.HCSParams.PortCount; i++)
-                    {
-                        if (hcd->Ports[i].PortChange)
-                        {
-                            DPRINT1("Inform hub driver that port %d has changed\n", i+1);
-                            ((PUCHAR)Urb->UrbBulkOrInterruptTransfer.TransferBuffer)[0] = 1 << ((i + 1) & 7);
-                        }
-                    }
-                }
-                else
-                {
-                    Urb->UrbHeader.Status = USBD_STATUS_INVALID_PARAMETER;
-                    Status = STATUS_UNSUCCESSFUL;
-                    DPRINT1("Invalid transfer flags for SCE\n");
-                }
-            }
-            else
-                DPRINT1("Interrupt Transfer not for hub\n");
-            break;
-        }
-        case URB_FUNCTION_GET_STATUS_FROM_DEVICE:
-        {
-            DPRINT1("URB_FUNCTION_GET_STATUS_FROM_DEVICE\n");
-            /* If for the hub device */
-            if ((Urb->UrbControlGetStatusRequest.Index == 0) && (UsbDevice == PdoDeviceExtension->UsbDevices[0]))
-            {
-                ASSERT(Urb->UrbBulkOrInterruptTransfer.TransferBuffer != NULL);
-                *(PUSHORT)Urb->UrbControlGetStatusRequest.TransferBuffer = USB_PORT_STATUS_CONNECT /*| USB_PORT_STATUS_ENABLE*/;
-            }
-            else
-            {
-                DPRINT1("UsbDeviceHandle %x, Index %x not implemented yet\n", UsbDevice, Urb->UrbControlGetStatusRequest.Index);
-                Urb->UrbHeader.Status = USBD_STATUS_INVALID_URB_FUNCTION;
-                Status = STATUS_UNSUCCESSFUL;
-            }
-            break;
-        }
-        case URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
-        {
-            USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup;
-            
-            DPRINT1("URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE\n");
-            switch(Urb->UrbControlDescriptorRequest.DescriptorType)
-            {
-                case USB_DEVICE_DESCRIPTOR_TYPE:
-                {
-                    PUCHAR BufPtr;
-                    DPRINT1("Device Descr Type\n");
-
-                    if (Urb->UrbControlDescriptorRequest.TransferBufferLength >= sizeof(USB_DEVICE_DESCRIPTOR))
-                    {
-                        Urb->UrbControlDescriptorRequest.TransferBufferLength = sizeof(USB_DEVICE_DESCRIPTOR);
-                    }
-                    if (UsbDevice == PdoDeviceExtension->UsbDevices[0])
-                    {
-                        BufPtr = (PUCHAR)Urb->UrbControlDescriptorRequest.TransferBuffer;
-
-                        /* Copy the Device Descriptor */
-                        RtlCopyMemory(BufPtr, &UsbDevice->DeviceDescriptor, sizeof(USB_DEVICE_DESCRIPTOR));
-                        DumpDeviceDescriptor((PUSB_DEVICE_DESCRIPTOR)Urb->UrbControlDescriptorRequest.TransferBuffer);
-                        break;
-                    }
-
-                    ASSERT(Urb->UrbControlDescriptorRequest.TransferBuffer != NULL);
-
-                    BuildSetupPacketFromURB(&FdoDeviceExtension->hcd, Urb, &CtrlSetup);
-                    IoMarkIrpPending(Irp);
-                    Status = STATUS_PENDING;
-                    ExecuteTransfer(FdoDeviceExtension->DeviceObject,
-                                    UsbDevice,
-                                    0,
-                                    &CtrlSetup,
-                                    0,
-                                    Urb->UrbControlDescriptorRequest.TransferBuffer ?
-                                        Urb->UrbControlDescriptorRequest.TransferBuffer : 
-                                        (PVOID)Urb->UrbControlDescriptorRequest.TransferBufferMDL,
-                                    Urb->UrbControlDescriptorRequest.TransferBuffer ?
-                                        Urb->UrbControlDescriptorRequest.TransferBufferLength : 0,
-                                    Irp);
-                    break;
-                }
-                case USB_CONFIGURATION_DESCRIPTOR_TYPE:
-                {
-                    PUCHAR BufPtr;
-                    LONG i, j;
-                    DPRINT1("Config Descr Type\n");
-                    if (UsbDevice == PdoDeviceExtension->UsbDevices[0])
-                    {
-                        DPRINT1("ROOTHUB!\n");
-                    }
-                    if (Urb->UrbControlDescriptorRequest.TransferBufferLength >= UsbDevice->ActiveConfig->ConfigurationDescriptor.wTotalLength)
-                    {
-                        Urb->UrbControlDescriptorRequest.TransferBufferLength = UsbDevice->ActiveConfig->ConfigurationDescriptor.wTotalLength;
-                    }
-                    else
-                    {
-                        DPRINT1("TransferBufferLenth %x is too small!!!\n", Urb->UrbControlDescriptorRequest.TransferBufferLength);
-                        if (Urb->UrbControlDescriptorRequest.TransferBufferLength < sizeof(USB_CONFIGURATION_DESCRIPTOR))
-                        {
-                            DPRINT1("Configuration Descriptor cannot fit into given buffer!\n");
-                            break;
-                        }
-                    }
-
-                    ASSERT(Urb->UrbControlDescriptorRequest.TransferBuffer);
-                    BufPtr = (PUCHAR)Urb->UrbControlDescriptorRequest.TransferBuffer;
-
-                    DPRINT1("Length %x\n", Urb->UrbControlDescriptorRequest.TransferBufferLength);
-
-                    /* Copy the Configuration Descriptor */
-                    RtlCopyMemory(BufPtr, &UsbDevice->ActiveConfig->ConfigurationDescriptor, sizeof(USB_CONFIGURATION_DESCRIPTOR));
-
-                    /* If there is no room for all the configs then bail */
-                    if (!(Urb->UrbControlDescriptorRequest.TransferBufferLength > sizeof(USB_CONFIGURATION_DESCRIPTOR)))
-                    {
-                        DPRINT("All Descriptors cannot fit into given buffer! Only USB_CONFIGURATION_DESCRIPTOR given\n");
-                        break;
-                    }
-
-                    BufPtr += sizeof(USB_CONFIGURATION_DESCRIPTOR);
-                    for (i = 0; i < UsbDevice->ActiveConfig->ConfigurationDescriptor.bNumInterfaces; i++)
-                    {
-                        /* Copy the Interface Descriptor */
-                        RtlCopyMemory(BufPtr,
-                                      &UsbDevice->ActiveConfig->Interfaces[i]->InterfaceDescriptor,
-                                      sizeof(USB_INTERFACE_DESCRIPTOR));
-                        BufPtr += sizeof(USB_INTERFACE_DESCRIPTOR);
-                        for (j = 0; j < UsbDevice->ActiveConfig->Interfaces[i]->InterfaceDescriptor.bNumEndpoints; j++)
-                        {
-                            /* Copy the EndPoint Descriptor */
-                            RtlCopyMemory(BufPtr,
-                                          &UsbDevice->ActiveConfig->Interfaces[i]->EndPoints[j]->EndPointDescriptor,
-                                          sizeof(USB_ENDPOINT_DESCRIPTOR));
-                            BufPtr += sizeof(USB_ENDPOINT_DESCRIPTOR);
-                        }
-                    }
-                    DumpFullConfigurationDescriptor((PUSB_CONFIGURATION_DESCRIPTOR)Urb->UrbControlDescriptorRequest.TransferBuffer);
-                    break;
-                }
-                case USB_STRING_DESCRIPTOR_TYPE:
-                {
-                    DPRINT1("StringDescriptorType\n");
-                    DPRINT1("Urb->UrbControlDescriptorRequest.Index %x\n", Urb->UrbControlDescriptorRequest.Index);
-                    DPRINT1("Urb->UrbControlDescriptorRequest.LanguageId %x\n", Urb->UrbControlDescriptorRequest.LanguageId);
-
-                    if (Urb->UrbControlDescriptorRequest.Index == 0)
-                        DPRINT1("Requesting LANGID's\n");
-
-                    BuildSetupPacketFromURB(&FdoDeviceExtension->hcd, Urb, &CtrlSetup);
-                    IoMarkIrpPending(Irp);
-                    Status = STATUS_PENDING;
-                    ExecuteTransfer(FdoDeviceExtension->DeviceObject,
-                                    UsbDevice,
-                                    0,
-                                    &CtrlSetup,
-                                    0,
-                                    Urb->UrbControlDescriptorRequest.TransferBuffer ?
-                                        Urb->UrbControlDescriptorRequest.TransferBuffer : 
-                                        (PVOID)Urb->UrbControlDescriptorRequest.TransferBufferMDL,
-                                    Urb->UrbControlDescriptorRequest.TransferBuffer ?
-                                        Urb->UrbControlDescriptorRequest.TransferBufferLength : 0,
-                                    Irp);
-                    break;
-                }
-                default:
-                {
-                    DPRINT1("Descriptor Type %x not supported!\n", Urb->UrbControlDescriptorRequest.DescriptorType);
-                }
-            }
-            break;
-        }
-        case URB_FUNCTION_SELECT_CONFIGURATION:
-        {
-            PUSBD_INTERFACE_INFORMATION InterfaceInfo;
-            LONG iCount, pCount;
-
-            DPRINT("Selecting Configuration\n");
-            DPRINT("ConfigurationHandle %x\n",Urb->UrbSelectConfiguration.ConfigurationHandle);
-
-            if (Urb->UrbSelectConfiguration.ConfigurationDescriptor)
-            {
-                Urb->UrbSelectConfiguration.ConfigurationHandle = &UsbDevice->ActiveConfig->ConfigurationDescriptor;
-                DPRINT("ConfigHandle %x\n", Urb->UrbSelectConfiguration.ConfigurationHandle);
-                InterfaceInfo = &Urb->UrbSelectConfiguration.Interface;
-
-                DPRINT("Length %x\n", InterfaceInfo->Length);
-                DPRINT("NumberOfPipes %x\n", InterfaceInfo->NumberOfPipes);
-
-                for (iCount = 0; iCount < Urb->UrbSelectConfiguration.ConfigurationDescriptor->bNumInterfaces; iCount++)
-                {
-                    InterfaceInfo->InterfaceHandle = (PVOID)&UsbDevice->ActiveInterface->InterfaceDescriptor;
-                    InterfaceInfo->Class = UsbDevice->ActiveInterface->InterfaceDescriptor.bInterfaceClass;
-                    InterfaceInfo->SubClass = UsbDevice->ActiveInterface->InterfaceDescriptor.bInterfaceSubClass;
-                    InterfaceInfo->Protocol = UsbDevice->ActiveInterface->InterfaceDescriptor.bInterfaceProtocol;
-                    InterfaceInfo->Reserved = 0;
-
-                    for (pCount = 0; pCount < InterfaceInfo->NumberOfPipes; pCount++)
-                    {
-                        InterfaceInfo->Pipes[pCount].MaximumPacketSize = UsbDevice->ActiveInterface->EndPoints[pCount]->EndPointDescriptor.wMaxPacketSize;
-                        InterfaceInfo->Pipes[pCount].EndpointAddress = UsbDevice->ActiveInterface->EndPoints[pCount]->EndPointDescriptor.bEndpointAddress;
-                        InterfaceInfo->Pipes[pCount].Interval = UsbDevice->ActiveInterface->EndPoints[pCount]->EndPointDescriptor.bInterval;
-                        InterfaceInfo->Pipes[pCount].PipeType = UsbDevice->ActiveInterface->EndPoints[pCount]->EndPointDescriptor.bmAttributes;
-                        InterfaceInfo->Pipes[pCount].PipeHandle = (PVOID)&UsbDevice->ActiveInterface->EndPoints[pCount]->EndPointDescriptor;
-                        if (InterfaceInfo->Pipes[pCount].MaximumTransferSize == 0)
-                            InterfaceInfo->Pipes[pCount].MaximumTransferSize = 4096;
-                        /* InterfaceInfo->Pipes[j].PipeFlags = 0; */
-                    }
-                    InterfaceInfo = (PUSBD_INTERFACE_INFORMATION)((PUCHAR)InterfaceInfo + InterfaceInfo->Length);
-                    if (InterfaceInfo->Length == 0) break;
-                }
-                
-                if (UsbDevice != PdoDeviceExtension->UsbDevices[0])
-                {
-                    DPRINT("Setting Configuration!\n");
-                    BuildSetupPacketFromURB(&FdoDeviceExtension->hcd, Urb, &CtrlSetup);
-                    IoMarkIrpPending(Irp);
-                    Status = STATUS_PENDING;
-                    DPRINT1("Input Buffer %x, MDL %x\n", Urb->UrbBulkOrInterruptTransfer.TransferBuffer, (PVOID)Urb->UrbBulkOrInterruptTransfer.TransferBufferMDL);
-
-                    ExecuteTransfer(FdoDeviceExtension->DeviceObject,
-                                    UsbDevice,
-                                    0,
-                                    &CtrlSetup,
-                                    0,
-                                    NULL,
-                                    0,
-                                    Irp);
-                    break;
-                }
-                else
-                {
-                    DPRINT1("Hub only has one configuration.\n");
-                }
-            }
-            else
-            {
-                /* FIXME: Set device to unconfigured state */
-                DPRINT1("Setting device to unconfigured state not implemented!\n");
-            }
-            break;
-        }
-        case URB_FUNCTION_SELECT_INTERFACE:
-        {
-            PUSBD_INTERFACE_INFORMATION InterfaceInfo;
-            int i;
-
-            DPRINT1("Select Interface!\n");
-            DPRINT1("Config Handle %x\n", Urb->UrbSelectInterface.ConfigurationHandle);
-
-            InterfaceInfo = &Urb->UrbSelectInterface.Interface;
-            DPRINT1("InterfaceNumber %x\n", InterfaceInfo->InterfaceNumber);
-            DPRINT1("AlternateSetting %x\n", InterfaceInfo->AlternateSetting);
-            DPRINT1("NumPipes %x\n", InterfaceInfo->NumberOfPipes);
-            for (i=0;i<InterfaceInfo->NumberOfPipes;i++)
-            {
-                InterfaceInfo->Pipes[i].PipeHandle = (PVOID)&UsbDevice->ActiveInterface->EndPoints[i]->EndPointDescriptor;
-            }
-
-            BuildSetupPacketFromURB(&FdoDeviceExtension->hcd, Urb, &CtrlSetup);
-            IoMarkIrpPending(Irp);
-            Status = STATUS_PENDING;
-            ExecuteTransfer(FdoDeviceExtension->DeviceObject,
-                            UsbDevice,
-                            0,
-                            &CtrlSetup,
-                            0,
-                            NULL,
-                            0,
-                            Irp);
-            break;
-        }
-        case URB_FUNCTION_CLASS_DEVICE:
-        {
-            DPRINT1("URB_FUNCTION_CLASS_DEVICE\n");
-            switch (Urb->UrbControlVendorClassRequest.Request)
-            {
-                case USB_REQUEST_GET_DESCRIPTOR:
-                {
-                    switch (Urb->UrbControlVendorClassRequest.Value >> 8)
-                    {
-                        case USB_DEVICE_CLASS_AUDIO:
-                        {
-                            DPRINT1("USB_DEVICE_CLASS_AUDIO not implemented\n");
-                            break;
-                        }
-                        case USB_DEVICE_CLASS_COMMUNICATIONS:
-                        {
-                            DPRINT1("USB_DEVICE_CLASS_COMMUNICATIONS not implemented\n");
-                            break;
-                        }
-                        case USB_DEVICE_CLASS_HUMAN_INTERFACE:
-                        {
-                            DPRINT1("USB_DEVICE_CLASS_HUMAN_INTERFACE not implemented\n");
-                            break;
-                        }
-                        case USB_DEVICE_CLASS_MONITOR:
-                        {
-                            DPRINT1("USB_DEVICE_CLASS_MONITOR not implemented\n");
-                            break;
-                        }
-                        case USB_DEVICE_CLASS_PHYSICAL_INTERFACE:
-                        {
-                            DPRINT1("USB_DEVICE_CLASS_PHYSICAL_INTERFACE not implemented\n");
-                            break;
-                        }
-                        case USB_DEVICE_CLASS_POWER:
-                        {
-                            DPRINT1("USB_DEVICE_CLASS_POWER not implemented\n");
-                            break;
-                        }
-                        case USB_DEVICE_CLASS_PRINTER:
-                        {
-                            DPRINT1("USB_DEVICE_CLASS_PRINTER not implemented\n");
-                            break;
-                        }
-                        case USB_DEVICE_CLASS_STORAGE:
-                        {
-                            DPRINT1("USB_DEVICE_CLASS_STORAGE not implemented\n");
-                            break;
-                        }
-                        case USB_DEVICE_CLASS_RESERVED:
-                            DPRINT1("Reserved!!!\n");
-                        case USB_DEVICE_CLASS_HUB:
-                        {
-                            PUSB_HUB_DESCRIPTOR UsbHubDescr = Urb->UrbControlVendorClassRequest.TransferBuffer;
-
-                            DPRINT1("Length %x\n", Urb->UrbControlVendorClassRequest.TransferBufferLength);
-                            ASSERT(Urb->UrbControlVendorClassRequest.TransferBuffer != 0);
-                            /* FIXME: Handle more than root hub? */
-                            if(Urb->UrbControlVendorClassRequest.TransferBufferLength >= sizeof(USB_HUB_DESCRIPTOR))
-                            {
-                                Urb->UrbControlVendorClassRequest.TransferBufferLength = sizeof(USB_HUB_DESCRIPTOR);
-                            }
-                            else
-                            {
-                                UsbHubDescr->bDescriptorLength = sizeof(USB_HUB_DESCRIPTOR);
-                                UsbHubDescr->bDescriptorType = 0x29;
-                                break;
-                            }
-                            DPRINT1("USB_DEVICE_CLASS_HUB request\n");
-                            UsbHubDescr->bDescriptorLength = sizeof(USB_HUB_DESCRIPTOR);
-                            UsbHubDescr->bDescriptorType = 0x29;
-                            UsbHubDescr->bNumberOfPorts = hcd->ECHICaps.HCSParams.PortCount;
-                            UsbHubDescr->wHubCharacteristics = 0x0012;
-                            UsbHubDescr->bPowerOnToPowerGood = 0x01;
-                            UsbHubDescr->bHubControlCurrent = 0x00;
-                            UsbHubDescr->bRemoveAndPowerMask[0] = 0x00;
-                            UsbHubDescr->bRemoveAndPowerMask[1] = 0x00;
-                            UsbHubDescr->bRemoveAndPowerMask[2] = 0xff;
-                            break;
-                        }
-                        default:
-                        {
-                            DPRINT1("Unknown UrbControlVendorClassRequest Value\n");
-                        }
-                    }
-                    break;
-                }
-                case USB_REQUEST_GET_STATUS:
-                {
-                    DPRINT1("DEVICE: USB_REQUEST_GET_STATUS for port %d\n", Urb->UrbControlVendorClassRequest.Index);
-                    if (Urb->UrbControlVendorClassRequest.Index == 1)
-                    {
-                        ASSERT(Urb->UrbControlVendorClassRequest.TransferBuffer != 0);
-                        ((PULONG)Urb->UrbControlVendorClassRequest.TransferBuffer)[0] = 0;
-                    }
-                    break;
-                }
-                default:
-                {
-                    DPRINT1("Unhandled URB request for class device\n");
-                    Urb->UrbHeader.Status = USBD_STATUS_INVALID_URB_FUNCTION;
-                    ASSERT(FALSE);
-                }
-            }
-            break;
-        }
-        case URB_FUNCTION_CLASS_OTHER:
-        {
-            DPRINT("URB_FUNCTION_CLASS_OTHER\n");
-            /* FIXME: Each one of these needs to make sure that the index value is a valid for the number of ports and return STATUS_UNSUCCESSFUL if not */
-
-            switch (Urb->UrbControlVendorClassRequest.Request)
-            {
-                case USB_REQUEST_GET_STATUS:
-                {
-                    DPRINT("USB_REQUEST_GET_STATUS Port %d\n", Urb->UrbControlVendorClassRequest.Index);
-
-                    ASSERT(Urb->UrbControlVendorClassRequest.TransferBuffer != 0);
-                    DPRINT("PortStatus %x\n", hcd->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortStatus);
-                    DPRINT("PortChange %x\n", hcd->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortChange);
-                    ((PUSHORT)Urb->UrbControlVendorClassRequest.TransferBuffer)[0] = hcd->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortStatus;
-                    ((PUSHORT)Urb->UrbControlVendorClassRequest.TransferBuffer)[1] = hcd->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortChange;
-                    break;
-                }
-                case USB_REQUEST_CLEAR_FEATURE:
-                {
-                    switch (Urb->UrbControlVendorClassRequest.Value)
-                    {
-                        case C_PORT_CONNECTION:
-                            DPRINT("C_PORT_CONNECTION\n");
-                            hcd->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortChange &= ~USB_PORT_STATUS_CONNECT;
-                            break;
-                        case C_PORT_RESET:
-                            DPRINT("C_PORT_RESET\n");
-                            hcd->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortChange &= ~USB_PORT_STATUS_RESET;
-                            hcd->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortStatus |= USB_PORT_STATUS_ENABLE;
-                            break;
-                        default:
-                            DPRINT("Unknown Value for Clear Feature %x \n", Urb->UrbControlVendorClassRequest.Value);
-                            break;
-                    }
-                    break;
-                }
-                case USB_REQUEST_SET_FEATURE:
-                {
-                    DPRINT1("USB_REQUEST_SET_FEATURE Port %d, value %x\n", Urb->UrbControlVendorClassRequest.Index,
-                        Urb->UrbControlVendorClassRequest.Value);
-
-                    switch(Urb->UrbControlVendorClassRequest.Value)
-                    {
-                        case PORT_RESET:
-                        {
-                            DPRINT1("Port Reset %d\n", Urb->UrbControlVendorClassRequest.Index-1);
-                            hcd->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortChange |= USB_PORT_STATUS_RESET;
-                            hcd->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortStatus &= ~USB_PORT_STATUS_ENABLE;
-                            ResetPort(hcd, Urb->UrbControlVendorClassRequest.Index-1);
-                            break;
-                        }
-                        case PORT_ENABLE:
-                        {
-                            DPRINT1("PORT_ENABLE not implemented\n");
-                            break;
-                        }
-                        case PORT_POWER:
-                        {
-                            DPRINT1("PORT_POWER not implemented\n");
-                            break;
-                        }
-                        default:
-                        {
-                            DPRINT1("Unknown Set Feature!\n");
-                            break;
-                        }
-                    }
-
-                    if (!(hcd->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortStatus & 0x8000))
-                    {
-                        DPRINT1("------ PortStatus %x\n", hcd->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortStatus);
-                        DPRINT1("Calling CompletePendingURBRequest\n");
-                        
-                        CompletePendingURBRequest(PdoDeviceExtension);
-                    }
-
-                    break;
-                }
-                case USB_REQUEST_SET_ADDRESS:
-                {
-                    DPRINT1("USB_REQUEST_SET_ADDRESS\n");
-                    break;
-                }
-                case USB_REQUEST_GET_DESCRIPTOR:
-                {
-                    DPRINT1("USB_REQUEST_GET_DESCRIPTOR\n");
-                    break;
-                }
-                case USB_REQUEST_SET_DESCRIPTOR:
-                {
-                    DPRINT1("USB_REQUEST_SET_DESCRIPTOR\n");
-                    break;
-                }
-                case USB_REQUEST_GET_CONFIGURATION:
-                {
-                    DPRINT1("USB_REQUEST_GET_CONFIGURATION\n");
-                    break;
-                }
-                case USB_REQUEST_SET_CONFIGURATION:
-                {
-                    DPRINT1("USB_REQUEST_SET_CONFIGURATION\n");
-                    break;
-                }
-                case USB_REQUEST_GET_INTERFACE:
-                {
-                    DPRINT1("USB_REQUEST_GET_INTERFACE\n");
-                    break;
-                }
-                case USB_REQUEST_SET_INTERFACE:
-                {
-                    DPRINT1("USB_REQUEST_SET_INTERFACE\n");
-                    break;
-                }
-                case USB_REQUEST_SYNC_FRAME:
-                {
-                    DPRINT1("USB_REQUEST_SYNC_FRAME\n");
-                    break;
-                }
-                default:
-                {
-                    DPRINT1("Unknown Function Class Unknown request\n");
-                    break;
-                }
-            }
-            break;
-        }
-        case URB_FUNCTION_CONTROL_TRANSFER:
-        {
-            DPRINT1("URB_FUNCTION_CONTROL_TRANSFER\n");
-            DPRINT1("PipeHandle %x\n", Urb->UrbControlTransfer.PipeHandle);
-            DPRINT1("TransferFlags %x\n", Urb->UrbControlTransfer.TransferFlags);
-            DPRINT1("TransferLength %x\n", Urb->UrbControlTransfer.TransferBufferLength);
-            DPRINT1("TransferBuffer %x\n", Urb->UrbControlTransfer.TransferBuffer);
-            DPRINT1("TransferMDL %x\n", Urb->UrbControlTransfer.TransferBufferMDL);
-            DPRINT1("SetupPacket %x\n", Urb->UrbControlTransfer.SetupPacket);
-            ASSERT(FALSE);
-            break;
-        }
-        case URB_FUNCTION_CLASS_INTERFACE:
-        {
-            USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup;
-            DPRINT1("URB_FUNCTION_CLASS_INTERFACE\n");
-            DPRINT1("TransferFlags %x\n", Urb->UrbControlVendorClassRequest.TransferFlags);
-            DPRINT1("TransferBufferLength %x\n", Urb->UrbControlVendorClassRequest.TransferBufferLength);
-            DPRINT1("TransferBuffer %x\n", Urb->UrbControlVendorClassRequest.TransferBuffer);
-            DPRINT1("TransferBufferMDL %x\n", Urb->UrbControlVendorClassRequest.TransferBufferMDL);
-            DPRINT1("RequestTypeReservedBits %x\n", Urb->UrbControlVendorClassRequest.RequestTypeReservedBits);
-            DPRINT1("Request %x\n", Urb->UrbControlVendorClassRequest.Request);
-            DPRINT1("Value %x\n", Urb->UrbControlVendorClassRequest.Value);
-            DPRINT1("Index %x\n", Urb->UrbControlVendorClassRequest.Index);
-            CtrlSetup.bmRequestType.B = 0xa1; //FIXME: Const.
-            CtrlSetup.bRequest = Urb->UrbControlVendorClassRequest.Request;
-            CtrlSetup.wValue.W = Urb->UrbControlVendorClassRequest.Value;
-            CtrlSetup.wIndex.W = Urb->UrbControlVendorClassRequest.Index;
-            CtrlSetup.wLength = Urb->UrbControlVendorClassRequest.TransferBufferLength;
-            
-            IoMarkIrpPending(Irp);
-            Status = STATUS_PENDING;
-            ExecuteTransfer(FdoDeviceExtension->DeviceObject,
-                            UsbDevice,
-                            0,
-                            &CtrlSetup,
-                            0,
-                            Urb->UrbControlVendorClassRequest.TransferBuffer ?
-                                Urb->UrbControlVendorClassRequest.TransferBuffer : 
-                                (PVOID)Urb->UrbControlVendorClassRequest.TransferBufferMDL,
-                            Urb->UrbControlVendorClassRequest.TransferBuffer ?
-                                Urb->UrbControlVendorClassRequest.TransferBufferLength : 0,
-                            Irp);
-            break;
-        }
-        default:
-        {
-            DPRINT1("Unhandled URB %x\n", Urb->UrbHeader.Function);
-            Urb->UrbHeader.Status = USBD_STATUS_INVALID_URB_FUNCTION;
-        }
-    }
-
-    Irp->IoStatus.Status = Status;
-    Irp->IoStatus.Information = Information;
-    return Status;
-}
-
-VOID
-CompletePendingURBRequest(PPDO_DEVICE_EXTENSION DeviceExtension)
-{
-    PLIST_ENTRY NextIrp = NULL;
-    KIRQL oldIrql;
-    PIRP Irp = NULL;
-
-    KeAcquireSpinLock(&DeviceExtension->IrpQueueLock, &oldIrql);
-
-    if (IsListEmpty(&DeviceExtension->IrpQueue))
-    {
-        DPRINT1("There should have been one SCE request pending. Did the usbhub driver load?\n");
-        KeReleaseSpinLock(&DeviceExtension->IrpQueueLock, oldIrql);
-        ASSERT(FALSE);
-        return;
-    }
-    NextIrp = RemoveHeadList(&DeviceExtension->IrpQueue);
-    Irp = CONTAINING_RECORD(NextIrp, IRP, Tail.Overlay.ListEntry);
-
-    if (!Irp)
-    {
-        DPRINT1("No Irp\n");
-        return;
-    }
-
-    IoSetCancelRoutine(Irp, NULL);
-    KeReleaseSpinLock(&DeviceExtension->IrpQueueLock, oldIrql);
-
-    HandleUrbRequest(DeviceExtension, Irp);
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-}
-
diff --git a/drivers/usb/usbehci/misc.c b/drivers/usb/usbehci/misc.c
deleted file mode 100644 (file)
index 6c84c33..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * PROJECT:     ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        drivers/usb/usbehci/misc.c
- * PURPOSE:     Misceallenous operations.
- * PROGRAMMERS:
- *              Michael Martin (michael.martin@reactos.org)
- */
-
-#include "usbehci.h"
-#include <hubbusif.h>
-#include <usbbusif.h>
-
-/*
-   Get SymblicName from Parameters in Registry Key
-   Caller is responsible for freeing pool of returned pointer
-*/
-PWSTR
-GetSymbolicName(PDEVICE_OBJECT DeviceObject)
-{
-    NTSTATUS Status;
-    HANDLE DevInstRegKey;
-    UNICODE_STRING SymbolicName;
-    PKEY_VALUE_PARTIAL_INFORMATION KeyPartInfo;
-    ULONG SizeNeeded;
-    PWCHAR SymbolicNameString = NULL;
-
-    Status = IoOpenDeviceRegistryKey(DeviceObject,
-                                     PLUGPLAY_REGKEY_DEVICE,
-                                     STANDARD_RIGHTS_ALL,
-                                     &DevInstRegKey);
-
-    DPRINT("IoOpenDeviceRegistryKey PLUGPLAY_REGKEY_DEVICE Status %x\n", Status);
-
-    if (NT_SUCCESS(Status))
-    {
-        RtlInitUnicodeString(&SymbolicName, L"SymbolicName");
-        Status = ZwQueryValueKey(DevInstRegKey,
-                                 &SymbolicName,
-                                 KeyValuePartialInformation,
-                                 NULL,
-                                 0,
-                                 &SizeNeeded);
-
-        DPRINT("ZwQueryValueKey status %x, %d\n", Status, SizeNeeded);
-
-        if (Status == STATUS_BUFFER_TOO_SMALL)
-        {
-            KeyPartInfo = (PKEY_VALUE_PARTIAL_INFORMATION ) ExAllocatePool(PagedPool, SizeNeeded);
-            if (!KeyPartInfo)
-            {
-                DPRINT1("OUT OF MEMORY\n");
-                return NULL;
-            }
-            else
-            {
-                 Status = ZwQueryValueKey(DevInstRegKey,
-                                          &SymbolicName,
-                                          KeyValuePartialInformation,
-                                          KeyPartInfo,
-                                          SizeNeeded,
-                                          &SizeNeeded);
-
-                 SymbolicNameString = ExAllocatePool(PagedPool, (KeyPartInfo->DataLength + sizeof(WCHAR)));
-                 if (!SymbolicNameString)
-                 {
-                     return NULL;
-                 }
-                 RtlZeroMemory(SymbolicNameString, KeyPartInfo->DataLength + 2);
-                 RtlCopyMemory(SymbolicNameString, KeyPartInfo->Data, KeyPartInfo->DataLength);
-            }
-
-            ExFreePool(KeyPartInfo);
-        }
-
-        ZwClose(DevInstRegKey);
-    }
-
-    return SymbolicNameString;
-}
-
-/*
-   Get Physical Device Object Name from registry
-   Caller is responsible for freeing pool
-*/
-PWSTR
-GetPhysicalDeviceObjectName(PDEVICE_OBJECT DeviceObject)
-{
-    NTSTATUS Status;
-    PWSTR ObjectName = NULL;
-    ULONG SizeNeeded;
-
-    Status = IoGetDeviceProperty(DeviceObject,
-                                 DevicePropertyPhysicalDeviceObjectName,
-                                 0,
-                                 NULL,
-                                 &SizeNeeded);
-
-    if (Status != STATUS_BUFFER_TOO_SMALL)
-    {
-        DPRINT1("Expected STATUS_BUFFER_TOO_SMALL, got %x!\n", Status);
-        return NULL;
-    }
-
-    ObjectName = (PWSTR) ExAllocatePool(PagedPool, SizeNeeded + sizeof(WCHAR));
-    if (!ObjectName)
-    {
-        DPRINT1("Out of memory\n");
-        return NULL;
-    }
-
-    Status = IoGetDeviceProperty(DeviceObject,
-                                 DevicePropertyPhysicalDeviceObjectName,
-                                 SizeNeeded,
-                                 ObjectName,
-                                 &SizeNeeded);
-    if (!NT_SUCCESS(Status))
-    {
-        DPRINT1("Failed to Get Property\n");
-        return NULL;
-    }
-
-    return ObjectName;
-}
-
-PUSB_DEVICE DeviceHandleToUsbDevice(PPDO_DEVICE_EXTENSION PdoDeviceExtension, PUSB_DEVICE_HANDLE DeviceHandle)
-{
-    LONG i;
-
-    for (i=0; i<127; i++)
-    {
-        if (PdoDeviceExtension->UsbDevices[i] == (PUSB_DEVICE)DeviceHandle)
-            return (PUSB_DEVICE)DeviceHandle;
-    }
-    return NULL;
-}
diff --git a/drivers/usb/usbehci/pdo.c b/drivers/usb/usbehci/pdo.c
deleted file mode 100644 (file)
index 38829fc..0000000
+++ /dev/null
@@ -1,704 +0,0 @@
-/*
- * PROJECT:     ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        drivers/usb/usbehci/pdo.c
- * PURPOSE:     USB EHCI device driver.
- * PROGRAMMERS:
- *              Michael Martin (michael.martin@reactos.org)
- */
-
-#define INITGUID
-
-#include "usbehci.h"
-#include <hubbusif.h>
-#include <usbbusif.h>
-#include "usbiffn.h"
-#include <wdmguid.h>
-#include <stdio.h>
-#include <debug.h>
-
-/* Lifted from Linux with slight changes */
-const UCHAR ROOTHUB2_DEVICE_DESCRIPTOR [] =
-{
-    0x12,       /*  bLength; */
-    USB_DEVICE_DESCRIPTOR_TYPE,       /*  bDescriptorType; Device */
-    0x00, 0x20, /*  bcdUSB; v1.1 */
-    USB_DEVICE_CLASS_HUB,       /*  bDeviceClass; HUB_CLASSCODE */
-    0x01,       /*  bDeviceSubClass; */
-    0x00,       /*  bDeviceProtocol; [ low/full speeds only ] */
-    0x08,       /*  bMaxPacketSize0; 8 Bytes */
-    /* Fill Vendor and Product in when init root hub */
-    0x00, 0x00, /*  idVendor; */
-    0x00, 0x00, /*  idProduct; */
-    0x00, 0x00, /*  bcdDevice */
-    0x00,       /*  iManufacturer; */
-    0x00,       /*  iProduct; */
-    0x00,       /*  iSerialNumber; */
-    0x01        /*  bNumConfigurations; */
-
-};
-
-const UCHAR ROOTHUB2_CONFIGURATION_DESCRIPTOR [] =
-{
-    /* one configuration */
-    0x09,       /* bLength; */
-    0x02,       /* bDescriptorType; Configuration */
-    0x19, 0x00, /* wTotalLength; */
-    0x01,       /* bNumInterfaces; (1) */
-    0x23,       /* bConfigurationValue; */
-    0x00,       /* iConfiguration; */
-    0x40,       /* bmAttributes; */
-    0x00        /* MaxPower; */
-};
-
-const UCHAR ROOTHUB2_INTERFACE_DESCRIPTOR [] =
-{
-    /* one interface */
-    0x09,       /* bLength: Interface; */
-    0x04,       /* bDescriptorType; Interface */
-    0x00,       /* bInterfaceNumber; */
-    0x00,       /* bAlternateSetting; */
-    0x01,       /* bNumEndpoints; */
-    0x09,       /* bInterfaceClass; HUB_CLASSCODE */
-    0x01,       /* bInterfaceSubClass; */
-    0x00,       /* bInterfaceProtocol: */
-    0x00        /* iInterface; */
-};
-
-const UCHAR ROOTHUB2_ENDPOINT_DESCRIPTOR [] =
-{
-    /* one endpoint (status change endpoint) */
-    0x07,       /* bLength; */
-    0x05,       /* bDescriptorType; Endpoint */
-    0x81,       /* bEndpointAddress; IN Endpoint 1 */
-    0x03,       /* bmAttributes; Interrupt */
-    0x08, 0x00, /* wMaxPacketSize; 1 + (MAX_ROOT_PORTS / 8) */
-    0xFF        /* bInterval; (255ms -- usb 2.0 spec) */
-};
-
-NTSTATUS NTAPI
-PdoDispatchInternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
-    PPDO_DEVICE_EXTENSION PdoDeviceExtension;
-    PFDO_DEVICE_EXTENSION FdoDeviceExtension;
-    PIO_STACK_LOCATION Stack = NULL;
-    NTSTATUS Status = STATUS_UNSUCCESSFUL;
-    ULONG_PTR Information = 0;
-    PEHCI_HOST_CONTROLLER hcd;
-
-    PdoDeviceExtension = (PPDO_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
-    FdoDeviceExtension = (PFDO_DEVICE_EXTENSION) PdoDeviceExtension->ControllerFdo->DeviceExtension;
-
-    ASSERT(PdoDeviceExtension->Common.IsFdo == FALSE);
-
-    hcd = &FdoDeviceExtension->hcd;
-    Stack =  IoGetCurrentIrpStackLocation(Irp);
-
-    switch(Stack->Parameters.DeviceIoControl.IoControlCode)
-    {
-        case IOCTL_INTERNAL_USB_SUBMIT_URB:
-        {
-            PUSB_DEVICE UsbDevice = NULL;
-            URB *Urb;
-            ULONG i;
-
-            Urb = (PURB) Stack->Parameters.Others.Argument1;
-
-            UsbDevice = Urb->UrbHeader.UsbdDeviceHandle;
-
-            /* If there was no device passed then this URB is for the RootHub */
-            if (UsbDevice == NULL)
-                UsbDevice = PdoDeviceExtension->UsbDevices[0];
-
-            /* Check if it is a Status Change Endpoint (SCE). The Hub Driver sends this request and miniports mark the IRP pending
-               if there is no changes on any of the ports. When the DPC of miniport routine detects changes this IRP will be completed.
-               Based on XEN PV Usb Drivers */
-
-            if ((Urb->UrbHeader.Function == URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER) &&
-                (UsbDevice == PdoDeviceExtension->UsbDevices[0]))
-            {
-                DPRINT("URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER on SCE\n");
-                if (Urb->UrbBulkOrInterruptTransfer.PipeHandle != &UsbDevice->ActiveInterface->EndPoints[0]->EndPointDescriptor)
-                {
-                    DPRINT1("PipeHandle doesnt match SCE PipeHandle\n");
-                }
-
-                /* Queue the Irp first */
-                QueueURBRequest(PdoDeviceExtension, Irp);
-
-                /* Check for port changes */
-                if (EnumControllerPorts(hcd) == FALSE)
-                {
-                    DPRINT("No port change\n");
-                    Status = STATUS_PENDING;
-                    IoMarkIrpPending(Irp);
-                    break;
-                }
-
-                /* If we reached this point then port status has changed, so check
-                   which port */
-                for (i = 0; i < hcd->ECHICaps.HCSParams.PortCount; i++)
-                {
-                    if (hcd->Ports[i].PortChange == 0x01)
-                    {
-                        DPRINT1("On SCE request: Inform hub driver that port %d has changed\n", i+1);
-                        ASSERT(FALSE);
-                        ((PUCHAR)Urb->UrbBulkOrInterruptTransfer.TransferBuffer)[0] = 1 << ((i + 1) & 7);
-                        Information = 0;
-                        Status = STATUS_SUCCESS;
-                        /* Assume URB success */
-                        Urb->UrbHeader.Status = USBD_STATUS_SUCCESS;
-                        /* Set the DeviceHandle to the Internal Device */
-                        Urb->UrbHeader.UsbdDeviceHandle = UsbDevice;
-
-                        /* Request handled, Remove it from the queue */
-                        RemoveUrbRequest(PdoDeviceExtension, Irp);
-                        break;
-                    }
-                }
-                if (Status == STATUS_SUCCESS) break;
-
-                IoMarkIrpPending(Irp);
-                Status = STATUS_PENDING;
-                break;
-            }
-
-            Status = HandleUrbRequest(PdoDeviceExtension, Irp);
-
-            break;
-        }
-        case IOCTL_INTERNAL_USB_CYCLE_PORT:
-        {
-            DPRINT1("IOCTL_INTERNAL_USB_CYCLE_PORT\n");
-            break;
-        }
-        case IOCTL_INTERNAL_USB_ENABLE_PORT:
-        {
-            DPRINT1("IOCTL_INTERNAL_USB_ENABLE_PORT\n");
-            Information = 0;
-            Status = STATUS_SUCCESS;
-            break;
-        }
-        case IOCTL_INTERNAL_USB_GET_BUS_INFO:
-        {
-            DPRINT1("IOCTL_INTERNAL_USB_GET_BUS_INFO\n");
-            break;
-        }
-        case IOCTL_INTERNAL_USB_GET_BUSGUID_INFO:
-        {
-            DPRINT1("IOCTL_INTERNAL_USB_GET_BUSGUID_INFO\n");
-            break;
-        }
-        case IOCTL_INTERNAL_USB_GET_CONTROLLER_NAME:
-        {
-            DPRINT1("IOCTL_INTERNAL_USB_GET_CONTROLLER_NAME\n");
-            break;
-        }
-        case IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE:
-        {
-            DPRINT1("Ehci: IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE %x\n", Stack->Parameters.Others.Argument2);
-            if (Stack->Parameters.Others.Argument1)
-            {
-                /* Return the root hubs devicehandle */
-                DPRINT("Returning RootHub Handle %x\n", PdoDeviceExtension->UsbDevices[0]);
-                *(PVOID *)Stack->Parameters.Others.Argument1 = (PVOID)PdoDeviceExtension->UsbDevices[0];
-                Status = STATUS_SUCCESS;
-            }
-            else
-                Status = STATUS_INVALID_DEVICE_REQUEST;
-
-            break;
-
-        }
-        case IOCTL_INTERNAL_USB_GET_HUB_COUNT:
-        {
-            DPRINT1("Ehci: IOCTL_INTERNAL_USB_GET_HUB_COUNT %x\n", IOCTL_INTERNAL_USB_GET_HUB_COUNT);
-            ASSERT(Stack->Parameters.Others.Argument1 != NULL);
-            if (Stack->Parameters.Others.Argument1)
-            {
-                /* FIXME: Determine the number of hubs between the usb device and root hub. 
-                   For now we have at least one. */
-                *(PULONG)Stack->Parameters.Others.Argument1 = 1;
-            }
-            Status = STATUS_SUCCESS;
-            break;
-        }
-        case IOCTL_INTERNAL_USB_GET_HUB_NAME:
-        {
-            DPRINT1("IOCTL_INTERNAL_USB_GET_HUB_NAME\n");
-            break;
-        }
-        case IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO:
-        {
-            DPRINT1("IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO\n");
-            break;
-        }
-        case IOCTL_INTERNAL_USB_GET_PORT_STATUS:
-        {
-            DPRINT1("IOCTL_INTERNAL_USB_GET_PORT_STATUS\n");
-            break;
-        }
-        case IOCTL_INTERNAL_USB_RESET_PORT:
-        {
-            DPRINT1("IOCTL_INTERNAL_USB_RESET_PORT\n");
-            break;
-        }
-        case IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO:
-        {
-            DPRINT("IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO\n");
-            /* DDK documents that both the PDO and FDO are returned. However, while writing the UsbHub driver it was determine
-               that this was not the case. Windows usbehci driver gives the Pdo in both Arguments. Which makes sense as upper level
-               drivers should not be communicating with FDO. */
-            if (Stack->Parameters.Others.Argument1)
-                *(PVOID *)Stack->Parameters.Others.Argument1 = FdoDeviceExtension->Pdo;
-            if (Stack->Parameters.Others.Argument2)
-                *(PVOID *)Stack->Parameters.Others.Argument2 = FdoDeviceExtension->Pdo;
-            Information = 0;
-            Status = STATUS_SUCCESS;
-            break;
-        }
-        case IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION:
-        {
-            PUSB_IDLE_CALLBACK_INFO CallBackInfo;
-            DPRINT1("Ehci: IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION\n");
-            /* FIXME: Set Callback for safe power down */
-            CallBackInfo = Stack->Parameters.DeviceIoControl.Type3InputBuffer;
-
-            PdoDeviceExtension->IdleCallback = CallBackInfo->IdleCallback;
-            PdoDeviceExtension->IdleContext = CallBackInfo->IdleContext;
-
-            Information = 0;
-            Status = STATUS_SUCCESS;
-            break;
-        }
-        default:
-        {
-            DPRINT1("Unhandled IoControlCode %x\n", Stack->Parameters.DeviceIoControl.IoControlCode);
-            break;
-        }
-    }
-
-    Irp->IoStatus.Information = Information;
-
-    if (Status != STATUS_PENDING)
-        IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
-    return Status;
-}
-
-NTSTATUS
-PdoQueryId(PDEVICE_OBJECT DeviceObject, PIRP Irp, ULONG_PTR* Information)
-{
-    WCHAR Buffer[256];
-    ULONG Index = 0;
-    ULONG IdType;
-    UNICODE_STRING SourceString;
-    UNICODE_STRING String;
-    NTSTATUS Status;
-
-    IdType = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryId.IdType;
-
-    switch (IdType)
-    {
-        case BusQueryDeviceID:
-        {
-            RtlInitUnicodeString(&SourceString, L"USB\\ROOT_HUB20");
-            break;
-        }
-        case BusQueryHardwareIDs:
-        {
-            /* FIXME: Build from Device Vendor and Device ID */
-            Index += swprintf(&Buffer[Index], L"USB\\ROOT_HUB20&VID8086&PID265C&REV0000") + 1;
-            Index += swprintf(&Buffer[Index], L"USB\\ROOT_HUB20&VID8086&PID265C") + 1;
-            Index += swprintf(&Buffer[Index], L"USB\\ROOT_HUB20") + 1;
-
-            Buffer[Index] = UNICODE_NULL;
-            SourceString.Length = SourceString.MaximumLength = Index * sizeof(WCHAR);
-            SourceString.Buffer = Buffer;
-            break;
-
-        }
-        case BusQueryCompatibleIDs:
-        {
-            /* We have none */
-            return STATUS_SUCCESS;
-        }
-        case BusQueryInstanceID:
-        {
-            return STATUS_SUCCESS;
-        }
-        default:
-        {
-            DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_ID / unknown query id type 0x%lx\n", IdType);
-            return STATUS_NOT_SUPPORTED;
-        }
-    }
-
-    Status = DuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
-                                    &SourceString,
-                                    &String);
-
-    *Information = (ULONG_PTR)String.Buffer;
-    return Status;
-}
-
-NTSTATUS
-PdoQueryDeviceRelations(PDEVICE_OBJECT DeviceObject, PDEVICE_RELATIONS* pDeviceRelations)
-{
-    PDEVICE_RELATIONS DeviceRelations;
-
-    DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS));
-    if (!DeviceRelations)
-        return STATUS_INSUFFICIENT_RESOURCES;
-
-    DeviceRelations->Count = 1;
-    DeviceRelations->Objects[0] = DeviceObject;
-    ObReferenceObject(DeviceObject);
-
-    *pDeviceRelations = DeviceRelations;
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS NTAPI
-PdoDispatchPnp(
-    IN PDEVICE_OBJECT DeviceObject,
-    IN PIRP Irp)
-{
-    ULONG MinorFunction;
-    PIO_STACK_LOCATION Stack;
-    ULONG_PTR Information = Irp->IoStatus.Information;
-    NTSTATUS Status = Irp->IoStatus.Status;
-    PDEVICE_CAPABILITIES DeviceCapabilities;
-    ULONG i;
-
-    Stack = IoGetCurrentIrpStackLocation(Irp);
-    MinorFunction = Stack->MinorFunction;
-
-    switch (MinorFunction)
-    {
-        case IRP_MN_QUERY_REMOVE_DEVICE:
-        case IRP_MN_REMOVE_DEVICE:
-        case IRP_MN_CANCEL_REMOVE_DEVICE:
-        case IRP_MN_STOP_DEVICE:
-        case IRP_MN_QUERY_STOP_DEVICE:
-        case IRP_MN_CANCEL_STOP_DEVICE:
-        case IRP_MN_QUERY_DEVICE_TEXT:
-        case IRP_MN_SURPRISE_REMOVAL:
-        case IRP_MN_QUERY_RESOURCES:
-        case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
-        case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
-        {
-            Status = STATUS_SUCCESS;
-            break;
-        }
-
-        case IRP_MN_START_DEVICE:
-        {
-            PUSB_DEVICE RootHubDevice;
-            PPDO_DEVICE_EXTENSION PdoDeviceExtension;
-            PFDO_DEVICE_EXTENSION FdoDeviceExtension;
-            UNICODE_STRING InterfaceSymLinkName;
-
-            DPRINT1("Ehci: PDO StartDevice\n");
-            PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
-            FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension;
-
-            /* Create the root hub */
-            RootHubDevice = InternalCreateUsbDevice(1, 0, NULL, TRUE);
-
-            RtlCopyMemory(&RootHubDevice->DeviceDescriptor,
-                          ROOTHUB2_DEVICE_DESCRIPTOR,
-                          sizeof(ROOTHUB2_DEVICE_DESCRIPTOR));
-
-            RootHubDevice->DeviceDescriptor.idVendor = FdoDeviceExtension->VendorId;
-            RootHubDevice->DeviceDescriptor.idProduct = FdoDeviceExtension->DeviceId;
-
-            /* Here config, interfaces and descriptors are stored. This was duplicated from XEN PV Usb Drivers implementation.
-               Not sure that it is really needed as the information can be queueried from the device. */
-
-            RootHubDevice->Configs = ExAllocatePoolWithTag(NonPagedPool,
-                                                            sizeof(PVOID) * RootHubDevice->DeviceDescriptor.bNumConfigurations,
-                                                            USB_POOL_TAG);
-
-            RootHubDevice->Configs[0] = ExAllocatePoolWithTag(NonPagedPool,
-                                                            sizeof(USB_CONFIGURATION) + sizeof(PVOID) * ROOTHUB2_CONFIGURATION_DESCRIPTOR[4],
-                                                            USB_POOL_TAG);
-
-            RootHubDevice->Configs[0]->Interfaces[0] = ExAllocatePoolWithTag(NonPagedPool,
-                                                            sizeof(USB_INTERFACE) + sizeof(PVOID) * ROOTHUB2_INTERFACE_DESCRIPTOR[4],
-                                                            USB_POOL_TAG);
-
-            RootHubDevice->Configs[0]->Interfaces[0]->EndPoints[0] = ExAllocatePoolWithTag(NonPagedPool,
-                                                            sizeof(USB_ENDPOINT),
-                                                            USB_POOL_TAG);
-
-            RootHubDevice->ActiveConfig = RootHubDevice->Configs[0];
-            RootHubDevice->ActiveInterface = RootHubDevice->ActiveConfig->Interfaces[0];
-
-            RtlCopyMemory(&RootHubDevice->ActiveConfig->ConfigurationDescriptor,
-                          ROOTHUB2_CONFIGURATION_DESCRIPTOR,
-                          sizeof(ROOTHUB2_CONFIGURATION_DESCRIPTOR));
-
-            RtlCopyMemory(&RootHubDevice->ActiveConfig->Interfaces[0]->InterfaceDescriptor,
-                         ROOTHUB2_INTERFACE_DESCRIPTOR,
-                         sizeof(ROOTHUB2_INTERFACE_DESCRIPTOR));
-
-            RtlCopyMemory(&RootHubDevice->ActiveConfig->Interfaces[0]->EndPoints[0]->EndPointDescriptor,
-                         ROOTHUB2_ENDPOINT_DESCRIPTOR,
-                         sizeof(ROOTHUB2_ENDPOINT_DESCRIPTOR));
-            RootHubDevice->DeviceSpeed = UsbHighSpeed;
-            RootHubDevice->DeviceType = Usb20Device;
-
-            PdoDeviceExtension->UsbDevices[0] = RootHubDevice;
-
-            Status = IoRegisterDeviceInterface(DeviceObject, &GUID_DEVINTERFACE_USB_HUB, NULL, &InterfaceSymLinkName);
-            if (!NT_SUCCESS(Status))
-            {
-                DPRINT1("Failed to register interface\n");
-                return Status;
-            }
-            else
-            {
-                Status = IoSetDeviceInterfaceState(&InterfaceSymLinkName, TRUE);
-                if (!NT_SUCCESS(Status)) 
-                    return Status;
-            }
-
-            Status = STATUS_SUCCESS;
-            break;
-        }
-        case IRP_MN_QUERY_DEVICE_RELATIONS:
-        {
-            DPRINT1("Ehci: PDO QueryDeviceRelations\n");
-            switch (Stack->Parameters.QueryDeviceRelations.Type)
-            {
-                case TargetDeviceRelation:
-                {
-                    PDEVICE_RELATIONS DeviceRelations = NULL;
-                    Status = PdoQueryDeviceRelations(DeviceObject, &DeviceRelations);
-                    Information = (ULONG_PTR)DeviceRelations;
-                    break;
-                }
-                case BusRelations:
-                {
-                    PPDO_DEVICE_EXTENSION PdoDeviceExtension;
-                    PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
-
-                    DPRINT("BusRelations!!!!!\n");
-
-                    /* The hub driver has created the new device object and reported to pnp, as a result the pnp manager
-                       has sent this IRP and type, so leave the next SCE request pending until a new device arrives.
-                       Is there a better way to do this? */
-                    ExAcquireFastMutex(&PdoDeviceExtension->ListLock);
-                    PdoDeviceExtension->HaltQueue = TRUE;
-                    ExReleaseFastMutex(&PdoDeviceExtension->ListLock);
-                }
-                case RemovalRelations:
-                case EjectionRelations:
-                {
-                    /* Ignore the request */
-                    Information = Irp->IoStatus.Information;
-                    Status = Irp->IoStatus.Status;
-                    break;
-
-                }
-                default:
-                {
-                    DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unhandled type 0x%lx\n",
-                        Stack->Parameters.QueryDeviceRelations.Type);
-                    Status = STATUS_NOT_SUPPORTED;
-                    break;
-                }
-            }
-            break;
-        }
-        case IRP_MN_QUERY_CAPABILITIES:
-        {
-            DPRINT("Ehci: PDO Query Capabilities\n");
-
-            DeviceCapabilities = (PDEVICE_CAPABILITIES)Stack->Parameters.DeviceCapabilities.Capabilities;
-
-            DeviceCapabilities->LockSupported = FALSE;
-            DeviceCapabilities->EjectSupported = FALSE;
-            DeviceCapabilities->Removable = FALSE;
-            DeviceCapabilities->DockDevice = FALSE;
-            DeviceCapabilities->UniqueID = FALSE;
-            DeviceCapabilities->SilentInstall = FALSE;
-            DeviceCapabilities->RawDeviceOK = FALSE;
-            DeviceCapabilities->SurpriseRemovalOK = FALSE;
-            DeviceCapabilities->Address = 0;
-            DeviceCapabilities->UINumber = 0;
-            DeviceCapabilities->DeviceD2 = 1;
-
-             /* FIXME: Verify these settings are correct */
-            DeviceCapabilities->HardwareDisabled = FALSE;
-            //DeviceCapabilities->NoDisplayInUI = FALSE;
-            DeviceCapabilities->DeviceState[0] = PowerDeviceD0;
-            for (i = 0; i < PowerSystemMaximum; i++)
-                DeviceCapabilities->DeviceState[i] = PowerDeviceD3;
-            DeviceCapabilities->DeviceWake = 0;
-            DeviceCapabilities->D1Latency = 0;
-            DeviceCapabilities->D2Latency = 0;
-            DeviceCapabilities->D3Latency = 0;
-            Information = 0;
-            Status = STATUS_SUCCESS;
-            break;
-        }
-        /*case IRP_MN_QUERY_DEVICE_TEXT:
-        {
-            Status = STATUS_NOT_SUPPORTED;
-            break;
-        }*/
-
-        case IRP_MN_QUERY_ID:
-        {
-            DPRINT("Ehci: PDO Query ID\n");
-            Status = PdoQueryId(DeviceObject, Irp, &Information);
-            break;
-        }
-        case IRP_MN_QUERY_INTERFACE:
-        {
-            UNICODE_STRING GuidString;
-            PUSB_BUS_INTERFACE_HUB_V5 InterfaceHub;
-            PUSB_BUS_INTERFACE_USBDI_V2 InterfaceDI;
-            PPDO_DEVICE_EXTENSION PdoDeviceExtension;
-            PFDO_DEVICE_EXTENSION FdoDeviceExtension;
-
-            DPRINT("Ehci: PDO Query Interface\n");
-
-            PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
-            FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension;
-
-            Status = RtlStringFromGUID(Stack->Parameters.QueryInterface.InterfaceType, &GuidString);
-            if (!NT_SUCCESS(Status))
-            {
-                DPRINT1("Failed to create string from GUID!\n");
-            }
-
-            /* Assume success */
-            Status = STATUS_SUCCESS;
-            Information = 0;
-
-            if (IsEqualGUIDAligned(Stack->Parameters.QueryInterface.InterfaceType, &USB_BUS_INTERFACE_HUB_GUID))
-            {
-                InterfaceHub = (PUSB_BUS_INTERFACE_HUB_V5)Stack->Parameters.QueryInterface.Interface;
-                InterfaceHub->Version = Stack->Parameters.QueryInterface.Version;
-                if (Stack->Parameters.QueryInterface.Version >= 0)
-                {
-                    InterfaceHub->Size = Stack->Parameters.QueryInterface.Size;
-                    InterfaceHub->BusContext = PdoDeviceExtension->DeviceObject;
-                    InterfaceHub->InterfaceReference = (PINTERFACE_REFERENCE)InterfaceReference;
-                    InterfaceHub->InterfaceDereference = (PINTERFACE_DEREFERENCE)InterfaceDereference;
-                }
-                if (Stack->Parameters.QueryInterface.Version >= 1)
-                {
-                    InterfaceHub->CreateUsbDevice = CreateUsbDevice;
-                    InterfaceHub->InitializeUsbDevice = InitializeUsbDevice;
-                    InterfaceHub->GetUsbDescriptors = GetUsbDescriptors;
-                    InterfaceHub->RemoveUsbDevice = RemoveUsbDevice;
-                    InterfaceHub->RestoreUsbDevice = RestoreUsbDevice;
-                    InterfaceHub->GetPortHackFlags = GetPortHackFlags;
-                    InterfaceHub->QueryDeviceInformation = QueryDeviceInformation;
-                }
-                if (Stack->Parameters.QueryInterface.Version >= 2)
-                {
-                    InterfaceHub->GetControllerInformation = GetControllerInformation;
-                    InterfaceHub->ControllerSelectiveSuspend = ControllerSelectiveSuspend;
-                    InterfaceHub->GetExtendedHubInformation = GetExtendedHubInformation;
-                    InterfaceHub->GetRootHubSymbolicName = GetRootHubSymbolicName;
-                    InterfaceHub->GetDeviceBusContext = GetDeviceBusContext;
-                    InterfaceHub->Initialize20Hub = Initialize20Hub;
-
-                }
-                if (Stack->Parameters.QueryInterface.Version >= 3)
-                {
-                    InterfaceHub->RootHubInitNotification = RootHubInitNotification;
-                }
-                if (Stack->Parameters.QueryInterface.Version >= 4)
-                {
-                    InterfaceHub->FlushTransfers = FlushTransfers;
-                }
-                if (Stack->Parameters.QueryInterface.Version >= 5)
-                {
-                    InterfaceHub->SetDeviceHandleData = SetDeviceHandleData;
-                }
-                if (Stack->Parameters.QueryInterface.Version >= 6)
-                {
-                    DPRINT1("USB_BUS_INTERFACE_HUB_GUID version not supported!\n");
-                }
-                break;
-            }
-
-            if (IsEqualGUIDAligned(Stack->Parameters.QueryInterface.InterfaceType, &USB_BUS_INTERFACE_USBDI_GUID))
-            {
-                InterfaceDI = (PUSB_BUS_INTERFACE_USBDI_V2) Stack->Parameters.QueryInterface.Interface;
-                InterfaceDI->Version = Stack->Parameters.QueryInterface.Version;
-                if (Stack->Parameters.QueryInterface.Version >= 0)
-                {
-                    //InterfaceDI->Size = sizeof(USB_BUS_INTERFACE_USBDI_V2);
-                    InterfaceDI->Size = Stack->Parameters.QueryInterface.Size;
-                    InterfaceDI->BusContext = PdoDeviceExtension->DeviceObject;
-                    InterfaceDI->InterfaceReference = (PINTERFACE_REFERENCE)InterfaceReference;
-                    InterfaceDI->InterfaceDereference = (PINTERFACE_DEREFERENCE)InterfaceDereference;
-                    InterfaceDI->GetUSBDIVersion = GetUSBDIVersion;
-                    InterfaceDI->QueryBusTime = QueryBusTime;
-                    InterfaceDI->SubmitIsoOutUrb = SubmitIsoOutUrb;
-                    InterfaceDI->QueryBusInformation = QueryBusInformation;
-                }
-                if (Stack->Parameters.QueryInterface.Version >= 1)
-                {
-                    InterfaceDI->IsDeviceHighSpeed = IsDeviceHighSpeed;
-                }
-                if (Stack->Parameters.QueryInterface.Version >= 2)
-                {
-                    InterfaceDI->EnumLogEntry = EnumLogEntry;
-                }
-
-                if (Stack->Parameters.QueryInterface.Version >= 3)
-                {
-                    DPRINT1("SB_BUS_INTERFACE_USBDI_GUID version not supported!\n");
-                }
-                break;
-            }
-
-            DPRINT1("GUID Not Supported\n");
-            Status = Irp->IoStatus.Status;
-            Information = Irp->IoStatus.Information;
-
-            break;
-        }
-        case IRP_MN_QUERY_BUS_INFORMATION:
-        {
-            PPNP_BUS_INFORMATION BusInfo;
-
-            BusInfo = (PPNP_BUS_INFORMATION)ExAllocatePool(PagedPool, sizeof(PNP_BUS_INFORMATION));
-            if (!BusInfo)
-                Status = STATUS_INSUFFICIENT_RESOURCES;
-            else
-            {
-                /* FIXME */
-                /*RtlCopyMemory(
-                    &BusInfo->BusTypeGuid,
-                    &GUID_DEVINTERFACE_XXX,
-                    sizeof(GUID));*/
-
-                BusInfo->LegacyBusType = PNPBus;
-                BusInfo->BusNumber = 0;
-                Information = (ULONG_PTR)BusInfo;
-                Status = STATUS_SUCCESS;
-            }
-            break;
-        }
-        default:
-        {
-            /* We are the PDO. So ignore */
-            DPRINT1("IRP_MJ_PNP / Unknown minor function 0x%lx\n", MinorFunction);
-            break;
-        }
-    }
-
-    Irp->IoStatus.Information = Information;
-    Irp->IoStatus.Status = Status;
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-    return Status;
-}
diff --git a/drivers/usb/usbehci/physmem.c b/drivers/usb/usbehci/physmem.c
deleted file mode 100644 (file)
index 09a964f..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * PROJECT:     ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        drivers/usb/usbehci/physmem.c
- * PURPOSE:     Common Buffer routines.
- * PROGRAMMERS:
- *              Michael Martin (michael.martin@reactos.org)
- */
-
-#include "physmem.h"
-#include "debug.h"
-
-#define SMALL_ALLOCATION_SIZE 32
-
-VOID
-DumpPages()
-{
-    //PMEM_HEADER MemBlock = (PMEM_HEADER)EhciSharedMemory.VirtualAddr;
-}
-
-// Returns Virtual Address of Allocated Memory
-ULONG
-AllocateMemory(PEHCI_HOST_CONTROLLER hcd, ULONG Size, ULONG *PhysicalAddress)
-{
-    PMEM_HEADER MemoryPage = NULL;
-    ULONG PageCount = 0;
-    ULONG NumberOfPages = hcd->CommonBufferSize / PAGE_SIZE;
-    ULONG BlocksNeeded = 0;
-    ULONG i,j, freeCount;
-    ULONG RetAddr = 0;
-
-    MemoryPage = (PMEM_HEADER)hcd->CommonBufferVA[0];
-    Size = ((Size + SMALL_ALLOCATION_SIZE - 1) / SMALL_ALLOCATION_SIZE) * SMALL_ALLOCATION_SIZE;
-    BlocksNeeded = Size / SMALL_ALLOCATION_SIZE;
-
-    do
-    {
-        if (MemoryPage->IsFull)
-        {
-            PageCount++;
-            
-            if (!(PMEM_HEADER)hcd->CommonBufferVA[PageCount])
-            {
-                hcd->CommonBufferVA[PageCount] =
-                    hcd->pDmaAdapter->DmaOperations->AllocateCommonBuffer(hcd->pDmaAdapter,
-                                                                          PAGE_SIZE,
-                                                                          &hcd->CommonBufferPA[PageCount],
-                                                                          FALSE);
-            }
-            MemoryPage = (PMEM_HEADER)hcd->CommonBufferVA[PageCount];
-            continue;
-        }
-        freeCount = 0;
-        for (i = 0; i < sizeof(MemoryPage->Entry); i++)
-        {
-            if (!MemoryPage->Entry[i].InUse)
-            {
-                freeCount++;
-            }
-            else
-            {
-                freeCount = 0;
-            }
-
-            if ((i-freeCount+1 + BlocksNeeded) > sizeof(MemoryPage->Entry))
-            {
-                freeCount = 0;
-                break;
-            }
-
-            if (freeCount == BlocksNeeded)
-            {
-                for (j = 0; j < freeCount; j++)
-                {
-                    MemoryPage->Entry[i-j].InUse = 1;
-                    MemoryPage->Entry[i-j].Blocks = 0;
-                }
-
-                MemoryPage->Entry[i-freeCount + 1].Blocks = BlocksNeeded;
-
-                RetAddr = (ULONG)MemoryPage + (SMALL_ALLOCATION_SIZE * (i - freeCount + 1)) + sizeof(MEM_HEADER);
-
-                *(ULONG*)PhysicalAddress = (ULONG)hcd->CommonBufferPA[PageCount].LowPart + (RetAddr - (ULONG)hcd->CommonBufferVA[PageCount]);
-
-                return RetAddr;
-            }
-        }
-
-        PageCount++;
-        if (!(PMEM_HEADER)hcd->CommonBufferVA[PageCount])
-        {
-            
-            hcd->CommonBufferVA[PageCount] =
-                hcd->pDmaAdapter->DmaOperations->AllocateCommonBuffer(hcd->pDmaAdapter,
-                                                                      PAGE_SIZE,
-                                                                      &hcd->CommonBufferPA[PageCount],
-                                                                      FALSE);
-            DPRINT1("Allocated CommonBuffer VA %x, PA %x\n", hcd->CommonBufferVA[PageCount], hcd->CommonBufferPA[PageCount]);
-        }
-        MemoryPage = (PMEM_HEADER)hcd->CommonBufferVA[PageCount];
-
-    } while (PageCount < NumberOfPages);
-
-    if (PageCount == NumberOfPages)
-        ASSERT(FALSE);
-
-    return 0;
-}
-
-VOID
-ReleaseMemory(PEHCI_HOST_CONTROLLER hcd, ULONG Address)
-{
-    PMEM_HEADER MemoryPage;
-    ULONG Index, i, BlockSize;
-
-    MemoryPage = (PMEM_HEADER)(Address & ~(PAGE_SIZE - 1));
-
-    Index = (Address - ((ULONG)MemoryPage + sizeof(MEM_HEADER))) / SMALL_ALLOCATION_SIZE;
-    BlockSize = MemoryPage->Entry[Index].Blocks;
-
-    for (i = 0; i < BlockSize; i++)
-    {
-        MemoryPage->Entry[Index + i].InUse = 0;
-        MemoryPage->Entry[Index + i].Blocks = 0;
-    }
-
-    if (MemoryPage != (PMEM_HEADER)hcd->CommonBufferVA[0])
-    {
-        for (i=0; i < sizeof(MemoryPage->Entry) / 2; i++)
-        {
-            if ((MemoryPage->Entry[i].InUse) || (MemoryPage->Entry[sizeof(MemoryPage->Entry) - i].InUse))
-                return;
-        }
-        DPRINT1("Freeing CommonBuffer VA %x, PA %x\n", MemoryPage, MmGetPhysicalAddress(MemoryPage));
-        hcd->pDmaAdapter->DmaOperations->FreeCommonBuffer(hcd->pDmaAdapter,
-                                                          PAGE_SIZE,
-                                                          MmGetPhysicalAddress(MemoryPage),
-                                                          MemoryPage,
-                                                          FALSE);
-    }
-}
diff --git a/drivers/usb/usbehci/physmem.h b/drivers/usb/usbehci/physmem.h
deleted file mode 100644 (file)
index b88f702..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#pragma once
-
-#include "hardware.h"
-
-typedef struct _MEM_ENTRY
-{
-    UCHAR InUse:1;
-    UCHAR Blocks:7;
-} MEM_ENTRY, *PMEM_ENTRY;
-
-typedef struct _MEM_HEADER
-{
-    UCHAR IsFull;
-    MEM_ENTRY Entry[124];
-    UCHAR Reserved[3];
-} MEM_HEADER, *PMEM_HEADER;
-
-VOID
-DumpPages(VOID);
-
-ULONG
-AllocateMemory(PEHCI_HOST_CONTROLLER hcd, ULONG Size, ULONG *PhysicalAddress);
-
-VOID
-ReleaseMemory(PEHCI_HOST_CONTROLLER hcd, ULONG Address);
diff --git a/drivers/usb/usbehci/transfer.c b/drivers/usb/usbehci/transfer.c
deleted file mode 100644 (file)
index 0f94a13..0000000
+++ /dev/null
@@ -1,547 +0,0 @@
-/*
- * PROJECT:     ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        drivers/usb/usbehci/transfer.c
- * PURPOSE:     Transfers to EHCI.
- * PROGRAMMERS:
- *              Michael Martin (michael.martin@reactos.org)
- */
-
-/* All QueueHeads, Descriptors and pipe setup packets used by control transfers are allocated from common buffer.
-   The routines in physmem manages this buffer. Each allocation is aligned to 32bits, which is requirement of USB 2.0. */
-
-#include "transfer.h"
-#include <debug.h>
-
-
-typedef struct _MAPREGISTERCALLBACKINFO
-{
-    PVOID MapRegisterBase;
-    KEVENT Event;
-}MAPREGISTERCALLBACKINFO, *PMAPREGISTERCALLBACKINFO;
-
-/* Fills CtrlSetup parameter with values based on Urb */
-VOID
-BuildSetupPacketFromURB(PEHCI_HOST_CONTROLLER hcd, PURB Urb, PUSB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup)
-{
-    switch (Urb->UrbHeader.Function)
-    {
-    /* CLEAR FEATURE */
-        case URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE:
-        case URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE:
-        case URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT:
-            DPRINT1("Not implemented!\n");
-            break;
-
-    /* GET CONFIG */
-        case URB_FUNCTION_GET_CONFIGURATION:
-            CtrlSetup->bRequest = USB_REQUEST_GET_CONFIGURATION;
-            CtrlSetup->bmRequestType.B = 0x80;
-            CtrlSetup->wLength = 1;
-            break;
-
-    /* GET DESCRIPTOR */
-        case URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
-            CtrlSetup->bRequest = USB_REQUEST_GET_DESCRIPTOR;
-            CtrlSetup->wValue.LowByte = Urb->UrbControlDescriptorRequest.Index;
-            CtrlSetup->wValue.HiByte = Urb->UrbControlDescriptorRequest.DescriptorType;
-            CtrlSetup->wIndex.W = Urb->UrbControlDescriptorRequest.LanguageId;
-            CtrlSetup->wLength = Urb->UrbControlDescriptorRequest.TransferBufferLength;
-            CtrlSetup->bmRequestType.B = 0x80;
-            break;
-
-    /* GET INTERFACE */
-        case URB_FUNCTION_GET_INTERFACE:
-            CtrlSetup->bRequest = USB_REQUEST_GET_CONFIGURATION;
-            CtrlSetup->wIndex.W = Urb->UrbControlGetStatusRequest.Index;
-            CtrlSetup->bmRequestType.B = 0x80;
-            CtrlSetup->wLength = 1;
-            break;
-
-    /* GET STATUS */
-        case URB_FUNCTION_GET_STATUS_FROM_DEVICE:
-            CtrlSetup->bRequest = USB_REQUEST_GET_STATUS;
-            ASSERT(Urb->UrbControlGetStatusRequest.Index == 0);
-            CtrlSetup->wIndex.W = Urb->UrbControlGetStatusRequest.Index;
-            CtrlSetup->bmRequestType.B = 0x80;
-            CtrlSetup->wLength = 2;
-            break;
-
-    case URB_FUNCTION_GET_STATUS_FROM_INTERFACE:
-            CtrlSetup->bRequest = USB_REQUEST_GET_STATUS;
-            ASSERT(Urb->UrbControlGetStatusRequest.Index != 0);
-            CtrlSetup->wIndex.W = Urb->UrbControlGetStatusRequest.Index;
-            CtrlSetup->bmRequestType.B = 0x81;
-            CtrlSetup->wLength = 2;
-            break;
-
-    case URB_FUNCTION_GET_STATUS_FROM_ENDPOINT:
-            CtrlSetup->bRequest = USB_REQUEST_GET_STATUS;
-            ASSERT(Urb->UrbControlGetStatusRequest.Index != 0);
-            CtrlSetup->wIndex.W = Urb->UrbControlGetStatusRequest.Index;
-            CtrlSetup->bmRequestType.B = 0x82;
-            CtrlSetup->wLength = 2;
-            break;
-
-    /* SET ADDRESS */
-
-    /* SET CONFIG */
-        case URB_FUNCTION_SELECT_CONFIGURATION:
-            DPRINT1("Bulding data for Select Config\n");
-            CtrlSetup->bRequest = USB_REQUEST_SET_CONFIGURATION;
-            CtrlSetup->wValue.W = Urb->UrbSelectConfiguration.ConfigurationDescriptor->bConfigurationValue;
-            CtrlSetup->wIndex.W = 0;
-            CtrlSetup->wLength = 0;            
-            CtrlSetup->bmRequestType.B = 0x00;
-            break;
-
-    /* SET DESCRIPTOR */
-        case URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE:
-        case URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE:
-        case URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT:
-            DPRINT1("Not implemented\n");
-            break;
-
-    /* SET FEATURE */
-        case URB_FUNCTION_SET_FEATURE_TO_DEVICE:
-            CtrlSetup->bRequest = USB_REQUEST_SET_FEATURE;
-            ASSERT(Urb->UrbControlGetStatusRequest.Index == 0);
-            CtrlSetup->wIndex.W = Urb->UrbControlGetStatusRequest.Index;
-            CtrlSetup->bmRequestType.B = 0x80;
-            break;
-
-        case URB_FUNCTION_SET_FEATURE_TO_INTERFACE:
-            CtrlSetup->bRequest = USB_REQUEST_SET_FEATURE;
-            ASSERT(Urb->UrbControlGetStatusRequest.Index == 0);
-            CtrlSetup->wIndex.W = Urb->UrbControlGetStatusRequest.Index;
-            CtrlSetup->bmRequestType.B = 0x81;
-            break;
-
-        case URB_FUNCTION_SET_FEATURE_TO_ENDPOINT:
-            CtrlSetup->bRequest = USB_REQUEST_SET_FEATURE;
-            ASSERT(Urb->UrbControlGetStatusRequest.Index == 0);
-            CtrlSetup->wIndex.W = Urb->UrbControlGetStatusRequest.Index;
-            CtrlSetup->bmRequestType.B = 0x82;
-            break;
-
-    /* SET INTERFACE*/
-        case URB_FUNCTION_SELECT_INTERFACE:
-            CtrlSetup->bRequest = USB_REQUEST_SET_INTERFACE;
-            CtrlSetup->wValue.W = Urb->UrbSelectInterface.Interface.AlternateSetting;
-            CtrlSetup->wIndex.W = Urb->UrbSelectInterface.Interface.InterfaceNumber;
-            CtrlSetup->wLength = 0;
-            CtrlSetup->bmRequestType.B = 0x01;
-            break;
-
-    /* SYNC FRAME */
-        case URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL:
-            DPRINT1("Not implemented\n");
-            break;
-        default:
-            DPRINT1("Unknown USB Request!\n");
-            break;
-    }
-}
-
-/* Build a Bulk Transfer with a max transfer of 3 descriptors which each has 5 pointers to one page of memory, paged align of course */
-PQUEUE_HEAD
-BuildBulkTransfer(PEHCI_HOST_CONTROLLER hcd,
-                   ULONG DeviceAddress,
-                   USBD_PIPE_HANDLE PipeHandle,
-                   UCHAR PidDirection,
-                   PMDL pMdl,
-                   BOOLEAN FreeMdl)
-{
-    PQUEUE_HEAD QueueHead;
-    PQUEUE_TRANSFER_DESCRIPTOR Descriptor[3];
-    ULONG MdlByteCount = MmGetMdlByteCount(pMdl);
-    ULONG NeededDescriptorCount = 1;
-    int i;
-
-    QueueHead = CreateQueueHead(hcd);
-    QueueHead->EndPointCharacteristics.DeviceAddress = DeviceAddress;
-
-    if (PipeHandle)
-    {
-        QueueHead->EndPointCharacteristics.EndPointNumber = ((PUSB_ENDPOINT_DESCRIPTOR)PipeHandle)->bEndpointAddress & 0x0F;
-        QueueHead->EndPointCharacteristics.MaximumPacketLength = ((PUSB_ENDPOINT_DESCRIPTOR)PipeHandle)->wMaxPacketSize;
-    }
-    
-    QueueHead->FreeMdl = FreeMdl;
-    QueueHead->Mdl = pMdl;
-
-    /* FIXME: This is totally screwed */
-    /* Calculate how many descriptors would be needed to transfer this buffer */
-    if (pMdl)
-    {
-        if (MdlByteCount < (PAGE_SIZE * 5))
-            NeededDescriptorCount = 1;
-        else if (MdlByteCount < (PAGE_SIZE * 10))
-            NeededDescriptorCount = 2;
-        else if (MdlByteCount < (PAGE_SIZE * 15))
-            NeededDescriptorCount = 3;
-        else
-            ASSERT(FALSE);
-    }
-    /* Limiter Transfers to PAGE_SIZE * 5 * 3, Three Descriptors */
-
-    QueueHead->NumberOfTransferDescriptors = NeededDescriptorCount;
-    for (i=0; i< NeededDescriptorCount;i++)
-    {
-        Descriptor[i] = CreateDescriptor(hcd,
-                                         PidDirection,
-                                         0);
-        Descriptor[i]->AlternateNextPointer = QueueHead->DeadDescriptor->PhysicalAddr;
-        
-        if (i > 0)
-        {
-            Descriptor[i-1]->NextDescriptor = Descriptor[i];
-            Descriptor[i]->PreviousDescriptor = Descriptor[i-1];
-            Descriptor[i-1]->NextPointer = Descriptor[i]->PhysicalAddr;
-        }
-    }
-
-    Descriptor[0]->Token.Bits.InterruptOnComplete = TRUE;
-
-    /* Save the first descriptor in the QueueHead */
-    QueueHead->FirstTransferDescriptor = Descriptor[0];
-    QueueHead->NextPointer = Descriptor[0]->PhysicalAddr;
-
-    return QueueHead;
-}
-
-
-/* Builds a QueueHead with 2 to 3 descriptors needed for control transfer
-   2 descriptors used for and control request that doesnt return data, such as SetAddress */
-PQUEUE_HEAD
-BuildControlTransfer(PEHCI_HOST_CONTROLLER hcd,
-                     ULONG DeviceAddress,
-                     USBD_PIPE_HANDLE PipeHandle,
-                     PUSB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup,
-                     PMDL pMdl,
-                     BOOLEAN FreeMdl)
-{
-    PQUEUE_HEAD QueueHead;
-    PQUEUE_TRANSFER_DESCRIPTOR Descriptor[3];
-    PUSB_DEFAULT_PIPE_SETUP_PACKET CtrlSetupVA, CtrlPhysicalPA;
-
-    CtrlSetupVA = (PUSB_DEFAULT_PIPE_SETUP_PACKET)AllocateMemory(hcd,
-                                                               sizeof(USB_DEFAULT_PIPE_SETUP_PACKET),
-                                                               (ULONG*)&CtrlPhysicalPA);
-
-    RtlCopyMemory(CtrlSetupVA, CtrlSetup, sizeof(USB_DEFAULT_PIPE_SETUP_PACKET));
-
-    QueueHead = CreateQueueHead(hcd);
-    QueueHead->EndPointCharacteristics.DeviceAddress = DeviceAddress;
-    if (PipeHandle)
-        QueueHead->EndPointCharacteristics.EndPointNumber = ((PUSB_ENDPOINT_DESCRIPTOR)PipeHandle)->bEndpointAddress & 0x0F;
-
-    QueueHead->Token.Bits.DataToggle = TRUE;
-    QueueHead->FreeMdl = FreeMdl;
-    QueueHead->Mdl = pMdl;
-
-    Descriptor[0] = CreateDescriptor(hcd,
-                                     PID_CODE_SETUP_TOKEN,
-                                     sizeof(USB_DEFAULT_PIPE_SETUP_PACKET));
-
-    Descriptor[0]->Token.Bits.DataToggle = FALSE;
-    /* Save the first descriptor */
-    QueueHead->FirstTransferDescriptor = Descriptor[0];
-
-    if (pMdl)
-    {
-        Descriptor[1] = CreateDescriptor(hcd,
-                                         PID_CODE_IN_TOKEN,
-                                         MmGetMdlByteCount(pMdl));
-
-        Descriptor[2] = CreateDescriptor(hcd,
-                                         PID_CODE_OUT_TOKEN,
-                                         0);
-    }
-    else
-    {
-        Descriptor[2] = CreateDescriptor(hcd,
-                                         PID_CODE_IN_TOKEN,
-                                         0);
-    }
-
-    Descriptor[2]->Token.Bits.InterruptOnComplete = TRUE;
-
-    /* Link the descriptors */
-    if (pMdl)
-    {
-        Descriptor[0]->NextDescriptor = Descriptor[1];
-        Descriptor[1]->NextDescriptor = Descriptor[2];
-        Descriptor[1]->PreviousDescriptor = Descriptor[0];
-        Descriptor[2]->PreviousDescriptor = Descriptor[1];
-    }
-    else
-    {
-        Descriptor[0]->NextDescriptor = Descriptor[2];
-        Descriptor[2]->PreviousDescriptor = Descriptor[0];
-    }
-    
-    /* Assign the descriptor buffers */
-    Descriptor[0]->BufferPointer[0] = (ULONG)CtrlPhysicalPA;
-    Descriptor[0]->BufferPointerVA[0] = (ULONG)CtrlSetupVA;
-    
-    if (pMdl)
-    {
-        Descriptor[0]->NextPointer = Descriptor[1]->PhysicalAddr;
-        Descriptor[0]->AlternateNextPointer = Descriptor[2]->PhysicalAddr;
-        Descriptor[1]->NextPointer = Descriptor[2]->PhysicalAddr;
-        Descriptor[1]->AlternateNextPointer = Descriptor[2]->PhysicalAddr;
-    }
-    else
-    {
-        Descriptor[0]->NextPointer = Descriptor[2]->PhysicalAddr;
-        Descriptor[0]->AlternateNextPointer = Descriptor[2]->PhysicalAddr;
-    }
-    
-    QueueHead->NextPointer = Descriptor[0]->PhysicalAddr;
-    if (pMdl)
-        QueueHead->NumberOfTransferDescriptors = 3;
-    else
-        QueueHead->NumberOfTransferDescriptors = 2;
-    return QueueHead;
-}
-
-
-IO_ALLOCATION_ACTION NTAPI MapRegisterCallBack(PDEVICE_OBJECT DeviceObject,
-                                               PIRP Irp,
-                                               PVOID MapRegisterBase,
-                                               PVOID Context)
-{
-    PMAPREGISTERCALLBACKINFO CallBackInfo = (PMAPREGISTERCALLBACKINFO)Context;
-    
-    CallBackInfo->MapRegisterBase = MapRegisterBase;
-    
-    KeSetEvent(&CallBackInfo->Event, IO_NO_INCREMENT, FALSE);
-    return KeepObject;
-}
-
-
-NTSTATUS
-ExecuteTransfer(PDEVICE_OBJECT DeviceObject,
-                PUSB_DEVICE UsbDevice,
-                USBD_PIPE_HANDLE PipeHandle,
-                PUSB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup,
-                ULONG TransferFlags,
-                PVOID TransferBufferOrMdl,
-                ULONG TransferBufferLength,
-                PIRP IrpToComplete)
-{
-    PUSB_ENDPOINT_DESCRIPTOR EndPointDesc = NULL;
-    PEHCI_HOST_CONTROLLER hcd;
-    PQUEUE_HEAD QueueHead;
-    PKEVENT CompleteEvent = NULL;
-    PMAPREGISTERCALLBACKINFO CallBackInfo;
-    LARGE_INTEGER TimeOut;
-    PMDL pMdl = NULL;
-    BOOLEAN FreeMdl = FALSE;
-    PVOID VirtualAddressOfMdl;
-    ULONG NumberOfMapRegisters;
-    KIRQL OldIrql;
-    NTSTATUS Status = STATUS_SUCCESS;
-    UCHAR EndPointType,  PidDirection;
-    BOOLEAN IsReadOp = TRUE;
-    ULONG TransferBtyesOffset, CurrentTransferBytes;
-    PQUEUE_TRANSFER_DESCRIPTOR Descriptor;
-    PHYSICAL_ADDRESS PhysicalAddr;
-    int i,j;
-
-    hcd = &((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->hcd;
-
-    /* If no Irp then we will need to wait on completion */
-    if (IrpToComplete == NULL)
-    {
-        CompleteEvent = ExAllocatePool(NonPagedPool, sizeof(KEVENT));
-        KeInitializeEvent(CompleteEvent, NotificationEvent, FALSE);
-    }
-
-    CallBackInfo = ExAllocatePool(NonPagedPool, sizeof(MAPREGISTERCALLBACKINFO));
-    CallBackInfo->MapRegisterBase = 0;
-
-    KeInitializeEvent(&CallBackInfo->Event, NotificationEvent, FALSE);
-
-    /* Determine EndPoint Type */
-    if (!PipeHandle)
-    {
-        EndPointType = USB_ENDPOINT_TYPE_CONTROL;
-    }
-    else
-    {
-        EndPointDesc = (PUSB_ENDPOINT_DESCRIPTOR)PipeHandle;
-        EndPointType = EndPointDesc->bmAttributes & 0x0F;
-    }
-
-    if (TransferBufferOrMdl)
-    {
-        /* Create MDL for Buffer */
-        if (TransferBufferLength)
-        {
-            pMdl = IoAllocateMdl(TransferBufferOrMdl,
-                                 TransferBufferLength,
-                                 FALSE,
-                                 FALSE,
-                                 NULL);
-            /* UEHCI created the MDL so it needs to free it */
-            FreeMdl = TRUE;
-        }
-        else
-        {
-            pMdl = TransferBufferOrMdl;
-        }
-        MmBuildMdlForNonPagedPool(pMdl);
-    }
-
-    switch (EndPointType)
-    {
-        case USB_ENDPOINT_TYPE_CONTROL:
-        {
-            QueueHead = BuildControlTransfer(hcd,
-                                             UsbDevice->Address,
-                                             PipeHandle,
-                                             CtrlSetup,
-                                             pMdl,
-                                             FreeMdl);
-            IsReadOp = TRUE;
-            break;
-        }
-        case USB_ENDPOINT_TYPE_BULK:
-        {
-            PidDirection = EndPointDesc->bEndpointAddress >> 7;
-            if (PidDirection)
-                IsReadOp = FALSE;
-
-            QueueHead = BuildBulkTransfer(hcd,
-                                          UsbDevice->Address,
-                                          PipeHandle,
-                                          PidDirection,
-                                          pMdl,
-                                          FreeMdl);
-            
-            break;
-        }
-        case USB_ENDPOINT_TYPE_INTERRUPT:
-        {
-            DPRINT1("Interrupt Endpoints not implemented yet!\n");
-            break;
-        }
-        case USB_ENDPOINT_TYPE_ISOCHRONOUS:
-        {
-            DPRINT1("Isochronous Endpoints not implemented yet!\n");
-            break;
-        }
-        default:
-        {
-            DPRINT1("Unknown Endpoint type!!\n");
-            break;
-        }
-    }
-
-    QueueHead->IrpToComplete = IrpToComplete;
-    QueueHead->Event = CompleteEvent;
-
-    if (!pMdl)
-    {
-        ASSERT(QueueHead->NumberOfTransferDescriptors == 2);
-        LinkQueueHead(hcd, QueueHead);
-        if (IrpToComplete == NULL)
-        {
-            DPRINT1("Waiting For Completion %x!\n", CompleteEvent);
-            TimeOut.QuadPart =  -10000000;
-            KeWaitForSingleObject(CompleteEvent, Suspended, KernelMode, FALSE, NULL);//&TimeOut);
-            DPRINT1("Request Completed\n");
-            ExFreePool(CompleteEvent);
-        }
-        return Status;
-    }
-    //ASSERT(FALSE);
-
-    KeFlushIoBuffers(pMdl, IsReadOp, TRUE);
-    NumberOfMapRegisters = 15;
-
-    KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
-    hcd->pDmaAdapter->DmaOperations->AllocateAdapterChannel(hcd->pDmaAdapter,
-                                                            ((PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->ControllerFdo,
-                                                            NumberOfMapRegisters,
-                                                            MapRegisterCallBack,
-                                                            (PVOID)CallBackInfo);
-    KeLowerIrql(OldIrql);
-    DPRINT1("Waiting for AdapterChannel\n");
-    KeWaitForSingleObject(&CallBackInfo->Event, Suspended, KernelMode, FALSE, NULL);
-    DPRINT1("Dma controller ready!\n");
-    DPRINT1("Getting address for MDL %x\n", pMdl);
-    
-    VirtualAddressOfMdl = MmGetMdlVirtualAddress(pMdl);
-
-    TransferBtyesOffset = 0;
-    while (TransferBtyesOffset < MmGetMdlByteCount(pMdl))
-    {
-        CurrentTransferBytes = MmGetMdlByteCount(pMdl);
-        Descriptor = QueueHead->FirstTransferDescriptor;
-        if ((Descriptor->Token.Bits.PIDCode == PID_CODE_SETUP_TOKEN) && (QueueHead->NumberOfTransferDescriptors == 3))
-        {
-            DPRINT1("QueueHead is for endpoint 0\n");
-            DPRINT1("MapRegisterBase %x\n", CallBackInfo->MapRegisterBase);
-            DPRINT1("VirtualAddressOfMdl %x, TransferBytesOffset %x\n", VirtualAddressOfMdl, TransferBtyesOffset);
-            Descriptor = Descriptor->NextDescriptor;
-            PhysicalAddr = hcd->pDmaAdapter->DmaOperations->MapTransfer(hcd->pDmaAdapter,
-                                                                        pMdl,
-                                                                        CallBackInfo->MapRegisterBase,
-                                                                        (PVOID)((ULONG_PTR)VirtualAddressOfMdl + TransferBtyesOffset),
-                                                                        &CurrentTransferBytes,
-                                                                        !IsReadOp);
-            DPRINT1("BufferPointer[0] = %x\n", PhysicalAddr.LowPart);
-            Descriptor->BufferPointer[0] = PhysicalAddr.LowPart;
-            DPRINT1("CurrentTransferBytes %x\n", CurrentTransferBytes);
-            TransferBtyesOffset += CurrentTransferBytes;
-            LinkQueueHead(hcd, QueueHead);
-            break;
-        }
-        DPRINT1("PID_CODE_SETUP_TOKEN %x, PidDirection %x, NumDesc %x\n", PID_CODE_SETUP_TOKEN, PidDirection, QueueHead->NumberOfTransferDescriptors);
-        for (i=0; i<QueueHead->NumberOfTransferDescriptors; i++)
-        {
-            if (Descriptor->Token.Bits.PIDCode != PID_CODE_SETUP_TOKEN)
-            {
-                for (j=0; j<5; j++)
-                {
-                    PhysicalAddr = hcd->pDmaAdapter->DmaOperations->MapTransfer(hcd->pDmaAdapter,
-                                                                                pMdl,
-                                                                                CallBackInfo->MapRegisterBase,
-                                                                                (PVOID)((ULONG_PTR)VirtualAddressOfMdl + TransferBtyesOffset),
-                                                                                &CurrentTransferBytes,
-                                                                                !IsReadOp);
-                    DPRINT1("BufferPointer[%d] = %x\n", j, PhysicalAddr.LowPart);
-                    Descriptor->BufferPointer[j] = PhysicalAddr.LowPart;
-                    TransferBtyesOffset += CurrentTransferBytes;
-                    if (TransferBtyesOffset >= MmGetMdlByteCount(pMdl))
-                        break;
-                }
-            }
-            Descriptor = Descriptor->NextDescriptor;
-        }
-        LinkQueueHead(hcd, QueueHead);
-        break;
-    }
-
-    if (TransferBtyesOffset < MmGetMdlByteCount(pMdl)) ASSERT(FALSE);
-    if (IrpToComplete == NULL)
-    {
-        DPRINT1("Waiting For Completion %x!\n", CompleteEvent);
-        TimeOut.QuadPart =  -10000000;
-        KeWaitForSingleObject(CompleteEvent, Suspended, KernelMode, FALSE, NULL);//&TimeOut);
-        DPRINT1("Request Completed\n");
-        ExFreePool(CompleteEvent);
-    }
-    
-    KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
-    hcd->pDmaAdapter->DmaOperations->FreeMapRegisters(hcd->pDmaAdapter,
-                                                      CallBackInfo->MapRegisterBase,
-                                                      NumberOfMapRegisters);
-
-    hcd->pDmaAdapter->DmaOperations->FreeAdapterChannel (hcd->pDmaAdapter);
-    KeLowerIrql(OldIrql);
-    return Status;
-}
diff --git a/drivers/usb/usbehci/transfer.h b/drivers/usb/usbehci/transfer.h
deleted file mode 100644 (file)
index a7d6f40..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#pragma once
-
-#include "hardware.h"
-#include "hwiface.h"
-#include "physmem.h"
-#include "usbehci.h"
-#include <usb.h>
-#include <ntddk.h>
-
-PQUEUE_HEAD
-BuildControlTransfer(PEHCI_HOST_CONTROLLER hcd,
-                     ULONG DeviceAddress,
-                     USBD_PIPE_HANDLE PipeHandle,
-                     PUSB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup,
-                     PMDL pMdl,
-                     BOOLEAN FreeMdl);
-
-PQUEUE_HEAD
-BuildBulkTransfer(PEHCI_HOST_CONTROLLER hcd,
-                   ULONG DeviceAddress,
-                   USBD_PIPE_HANDLE PipeHandle,
-                   UCHAR PidDirection,
-                   PMDL pMdl,
-                   BOOLEAN FreeMdl);
-
-VOID
-BuildSetupPacketFromURB(PEHCI_HOST_CONTROLLER hcd,
-                        PURB Urb,
-                        PUSB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup);
-
-NTSTATUS
-ExecuteTransfer(PDEVICE_OBJECT DeviceObject,
-                PUSB_DEVICE UsbDevice,
-                USBD_PIPE_HANDLE PipeHandle,
-                PUSB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup,
-                ULONG TransferFlags,
-                PVOID TransferBufferOrMdl,
-                ULONG TransferBufferLength,
-                PIRP IrpToComplete);
diff --git a/drivers/usb/usbehci/usbehci.c b/drivers/usb/usbehci/usbehci.c
deleted file mode 100644 (file)
index d4e85be..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * PROJECT:     ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        drivers/usb/usbehci/usbehci.c
- * PURPOSE:     USB EHCI device driver.
- * PROGRAMMERS:
- *              Michael Martin (michael.martin@reactos.org)
- */
-
-/* DEFINES *******************************************************************/
-#include "usbehci.h"
-
-NTSTATUS NTAPI
-DispatchDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
-    DPRINT("DispatchDeviceControl\n");
-    Irp->IoStatus.Information = 0;
-    Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
-
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-    return STATUS_UNSUCCESSFUL;
-}
-
-NTSTATUS NTAPI
-DispatchInternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
-    DPRINT("DispatchInternalDeviceControl\n");
-    if (((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFdo)
-    {
-        return FdoDispatchInternalDeviceControl(DeviceObject, Irp);
-    }
-    else
-        return PdoDispatchInternalDeviceControl(DeviceObject, Irp);
-}
-
-NTSTATUS NTAPI
-UsbEhciCleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
-    DPRINT1("UsbEhciCleanup\n");
-    Irp->IoStatus.Information = 0;
-    Irp->IoStatus.Status = STATUS_SUCCESS;
-
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS NTAPI
-UsbEhciCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
-    DPRINT1("UsbEhciCreate\n");
-    Irp->IoStatus.Information = 0;
-    Irp->IoStatus.Status = STATUS_SUCCESS;
-
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS NTAPI
-UsbEhciClose(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
-    DPRINT1("Close\n");
-    Irp->IoStatus.Information = 0;
-    Irp->IoStatus.Status = STATUS_SUCCESS;
-
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-    return STATUS_SUCCESS;
-}
-
-VOID NTAPI
-DriverUnload(PDRIVER_OBJECT DriverObject)
-{
-    DPRINT("Unloading Driver\n");
-    /* FIXME: Clean up */
-}
-
-NTSTATUS NTAPI
-DispatchPnp(PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
-    if (((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFdo)
-        return FdoDispatchPnp(DeviceObject, Irp);
-    else
-        return PdoDispatchPnp(DeviceObject, Irp);
-}
-
-NTSTATUS NTAPI
-DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
-{
-    DPRINT1("Driver Entry %wZ!\n", RegistryPath);
-
-    DriverObject->DriverExtension->AddDevice = AddDevice;
-    DriverObject->MajorFunction[IRP_MJ_CREATE] = UsbEhciCreate;
-    DriverObject->MajorFunction[IRP_MJ_CLOSE] = UsbEhciClose;
-    DriverObject->MajorFunction[IRP_MJ_CLEANUP] = UsbEhciCleanup;
-    DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchDeviceControl;
-    DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = DispatchInternalDeviceControl;
-    DriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp;
-    
-    DriverObject->DriverUnload = DriverUnload;
-    DPRINT1("Driver entry done\n");
-
-    return STATUS_SUCCESS;
-}
-
diff --git a/drivers/usb/usbehci/usbiffn.c b/drivers/usb/usbehci/usbiffn.c
deleted file mode 100644 (file)
index 1bc74d6..0000000
+++ /dev/null
@@ -1,832 +0,0 @@
-/*
- * PROJECT:     ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
- * LICENSE:     GPL - See COPYING in the top level directory
- * FILE:        drivers/usb/usbehci/usbiffn.c
- * PURPOSE:     Direct Call Interface Functions.
- * PROGRAMMERS:
- *              Michael Martin (michael.martin@reactos.org)
- */
-
-/* Many of these direct calls are documented on http://www.osronline.com */
-
-#include "usbehci.h"
-#include <hubbusif.h>
-#include <usbbusif.h>
-#include "hardware.h"
-#include "transfer.h"
-
-PVOID InternalCreateUsbDevice(ULONG Port, PUSB_DEVICE Parent, BOOLEAN Hub)
-{
-    PUSB_DEVICE UsbDevicePointer = NULL;
-
-    UsbDevicePointer = ExAllocatePoolWithTag(NonPagedPool, sizeof(USB_DEVICE), USB_POOL_TAG);
-
-    if (!UsbDevicePointer)
-    {
-        DPRINT1("Out of memory\n");
-        return NULL;
-    }
-
-    RtlZeroMemory(UsbDevicePointer, sizeof(USB_DEVICE));
-
-    if ((Hub) && (!Parent))
-    {
-        DPRINT1("This is the root hub\n");
-    }
-
-    UsbDevicePointer->Port = Port - 1;
-    UsbDevicePointer->ParentDevice = Parent;
-
-    UsbDevicePointer->IsHub = Hub;
-
-    return UsbDevicePointer;
-}
-
-VOID
-USB_BUSIFFN
-InterfaceReference(PVOID BusContext)
-{
-    DPRINT1("Ehci: InterfaceReference called\n");
-}
-
-VOID
-USB_BUSIFFN
-InterfaceDereference(PVOID BusContext)
-{
-    DPRINT1("Ehci: InterfaceDereference called\n");
-}
-
-/* Bus Interface Hub V5 Functions */
-
-
-/* Hub Driver calls this routine for each new device it is informed about on USB Bus
-   osronline documents that this is where the device address is assigned. It also
-   states the same for InitializeUsbDevice. This function only gets the device descriptor 
-   from the device and checks that the members for device are correct. */
-
-NTSTATUS
-USB_BUSIFFN
-CreateUsbDevice(PVOID BusContext,
-                PUSB_DEVICE_HANDLE *NewDevice,
-                PUSB_DEVICE_HANDLE HubDeviceHandle,
-                USHORT PortStatus, USHORT PortNumber)
-{
-    PPDO_DEVICE_EXTENSION PdoDeviceExtension;
-    PFDO_DEVICE_EXTENSION FdoDeviceExtension;
-    USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup;
-    PEHCI_HOST_CONTROLLER hcd;
-    PUSB_DEVICE UsbDevice;
-    LONG i;
-
-    DPRINT1("Ehci: CreateUsbDevice: HubDeviceHandle %x, PortStatus %x, PortNumber %x\n", HubDeviceHandle, PortStatus, PortNumber);
-    
-    PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
-    FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension;
-
-    hcd = &FdoDeviceExtension->hcd;
-
-    if (PdoDeviceExtension->UsbDevices[0] != HubDeviceHandle)
-    {
-        DPRINT1("Not a valid HubDeviceHandle\n");
-        return STATUS_DEVICE_NOT_CONNECTED;
-    }
-
-    UsbDevice = NULL;
-    /* Add it to the list */
-    for (i=0; i < MAX_USB_DEVICES; i++)
-    {
-        if (PdoDeviceExtension->UsbDevices[i] == NULL)
-        {
-            PdoDeviceExtension->UsbDevices[i] = InternalCreateUsbDevice(PortNumber, HubDeviceHandle, FALSE);
-            
-            if (!PdoDeviceExtension->UsbDevices[i])
-                return STATUS_INSUFFICIENT_RESOURCES;
-            UsbDevice = PdoDeviceExtension->UsbDevices[i];
-            break;
-        }
-    }
-
-    /* Check that a device was created */
-    if (!UsbDevice)
-    {
-        DPRINT1("Too many usb devices attached. Max is %d\n", MAX_USB_DEVICES);
-        return STATUS_UNSUCCESSFUL;
-    }
-
-    hcd->Ports[PortNumber - 1].PortStatus = PortStatus;
-
-    /* Get the device descriptor */
-    CtrlSetup.bRequest = USB_REQUEST_GET_DESCRIPTOR;
-    CtrlSetup.wValue.LowByte = 0;
-    CtrlSetup.wValue.HiByte = USB_DEVICE_DESCRIPTOR_TYPE;
-    CtrlSetup.wIndex.W = 0;
-    CtrlSetup.wLength = sizeof(USB_DEVICE_DESCRIPTOR);    
-    CtrlSetup.bmRequestType.B = 0x80;
-    ExecuteTransfer(FdoDeviceExtension->DeviceObject,
-                    UsbDevice,
-                    0,
-                    &CtrlSetup,
-                    0,
-                    &UsbDevice->DeviceDescriptor,
-                    sizeof(USB_DEVICE_DESCRIPTOR),
-                    NULL);
-
-    /* Check status and bLength and bDescriptor members */
-    if ((UsbDevice->DeviceDescriptor.bLength != 0x12) || (UsbDevice->DeviceDescriptor.bDescriptorType != 0x1))
-    {
-        return STATUS_DEVICE_DATA_ERROR;
-    }
-
-    DumpDeviceDescriptor(&UsbDevice->DeviceDescriptor);
-
-    /* Return it */
-    *NewDevice = UsbDevice;
-    return STATUS_SUCCESS;
-}
-
-/* Assigns the device an address, gets the configuration, interface, and endpoint descriptors
-   from the device. All this data is saved as part of this driver */
-
-NTSTATUS
-USB_BUSIFFN
-InitializeUsbDevice(PVOID BusContext, PUSB_DEVICE_HANDLE DeviceHandle)
-{
-    PPDO_DEVICE_EXTENSION PdoDeviceExtension;
-    PFDO_DEVICE_EXTENSION FdoDeviceExtension;
-    USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup;
-    USB_DEVICE_DESCRIPTOR DeviceDesc;
-    PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc;
-    PUSB_INTERFACE_DESCRIPTOR InterfaceDesc;
-    PUSB_ENDPOINT_DESCRIPTOR EndpointDesc;
-    PUSB_DEVICE UsbDevice;
-    PVOID Buffer;
-    PUCHAR Ptr;
-    UCHAR NewAddress = 0;
-
-    LONG i, j, k, InitAttept;
-
-    PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
-    FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension;
-
-    UsbDevice = DeviceHandleToUsbDevice(BusContext, DeviceHandle);
-
-    if (!UsbDevice)
-    {
-        DPRINT1("Invalid DeviceHandle or device not connected\n");
-        return STATUS_DEVICE_NOT_CONNECTED;
-    }
-
-    for (i=0; i<127; i++)
-    {
-        if (UsbDevice == PdoDeviceExtension->UsbDevices[i])
-        {
-            NewAddress = i;
-            break;
-        }
-    }
-
-    ASSERT(NewAddress);
-
-    /* Linux drivers make 3 attemps to set the device address because of problems with some devices. Do the same */
-    InitAttept = 0;
-    while (InitAttept < 3)
-    {
-        /* Set the device address */
-        CtrlSetup.bmRequestType.B = 0x00;
-        CtrlSetup.bRequest = USB_REQUEST_SET_ADDRESS;
-        CtrlSetup.wValue.W = NewAddress;
-        CtrlSetup.wIndex.W = 0;
-        CtrlSetup.wLength = 0;
-
-        DPRINT1("Setting Address to %x\n", NewAddress);
-        ExecuteTransfer(PdoDeviceExtension->ControllerFdo,
-                        UsbDevice,
-                        0,
-                        &CtrlSetup,
-                        0,
-                        NULL,
-                        0,
-                        NULL);
-
-        KeStallExecutionProcessor(300 * InitAttept);
-
-        /* Send 0 length packet to endpoint 0 for ack */
-/*
-        ExecuteTransfer(PdoDeviceExtension->ControllerFdo,
-                        UsbDevice,
-                        0,
-                        NULL,
-                        0,
-                        NULL,
-                        0,
-                        NULL);
-*/
-
-        CtrlSetup.bRequest = USB_REQUEST_GET_DESCRIPTOR;
-        CtrlSetup.wValue.LowByte = 0;
-        CtrlSetup.wValue.HiByte = USB_DEVICE_DESCRIPTOR_TYPE;
-        CtrlSetup.wIndex.W = 0;
-        CtrlSetup.wLength = sizeof(USB_DEVICE_DESCRIPTOR);    
-        CtrlSetup.bmRequestType.B = 0x80;
-
-        UsbDevice->Address = NewAddress;
-        ExecuteTransfer(FdoDeviceExtension->DeviceObject,
-                        UsbDevice,
-                        0,
-                        &CtrlSetup,
-                        0,
-                        &DeviceDesc,
-                        sizeof(USB_DEVICE_DESCRIPTOR),
-                        NULL);
-
-        DPRINT1("Length %d, DescriptorType %d\n", DeviceDesc.bLength, DeviceDesc.bDescriptorType);
-        if ((DeviceDesc.bLength == 0x12) && (DeviceDesc.bDescriptorType == 0x01))
-            break;
-        
-        /* If the descriptor was not gotten */
-        UsbDevice->Address = 0;
-        InitAttept++;
-    }
-    
-    if (InitAttept == 3)
-    {
-        DPRINT1("Unable to initialize usb device connected on port %d!\n", UsbDevice->Port);
-        /* FIXME: Should the memory allocated for this device be deleted? */
-        return STATUS_DEVICE_DATA_ERROR;
-    }
-    DumpDeviceDescriptor(&DeviceDesc);
-
-    if (UsbDevice->DeviceDescriptor.bNumConfigurations == 0)
-    {
-        DPRINT1("Device on port %d has no configurations!\n", UsbDevice->Port);
-        /* FIXME: Should the memory allocated for this device be deleted? */
-        return STATUS_DEVICE_DATA_ERROR;
-    }
-    UsbDevice->Configs = ExAllocatePoolWithTag(NonPagedPool,
-                                               sizeof(PVOID) * UsbDevice->DeviceDescriptor.bNumConfigurations,
-                                               USB_POOL_TAG);
-
-    if (!UsbDevice->Configs)
-    {
-        DPRINT1("Out of memory\n");
-        /* FIXME: Should the memory allocated for this device be deleted? */
-        return STATUS_NO_MEMORY;
-    }
-
-    Buffer = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, USB_POOL_TAG);
-
-    if (!Buffer)
-    {
-        DPRINT1("Out of memory\n");
-        /* FIXME: Should the memory allocated for this device be deleted? */
-        return STATUS_NO_MEMORY;
-    }
-
-    Ptr = Buffer;
-
-    for (i = 0; i < UsbDevice->DeviceDescriptor.bNumConfigurations; i++)
-    {
-        /* Get the Device Configuration Descriptor */
-        CtrlSetup.bmRequestType._BM.Recipient = BMREQUEST_TO_DEVICE;
-        CtrlSetup.bmRequestType._BM.Type = BMREQUEST_STANDARD;
-        CtrlSetup.bmRequestType._BM.Reserved = 0;
-        CtrlSetup.bmRequestType._BM.Dir = BMREQUEST_DEVICE_TO_HOST;
-        CtrlSetup.bRequest = USB_REQUEST_GET_DESCRIPTOR;
-        CtrlSetup.wValue.LowByte = 0;
-        CtrlSetup.wValue.HiByte = USB_CONFIGURATION_DESCRIPTOR_TYPE;
-        CtrlSetup.wIndex.W = 0;
-        CtrlSetup.wLength = PAGE_SIZE;
-        ExecuteTransfer(PdoDeviceExtension->ControllerFdo,
-                        UsbDevice,
-                        0,
-                        &CtrlSetup,
-                        0,
-                        Buffer,
-                        PAGE_SIZE,
-                        NULL);
-
-        ConfigDesc = (PUSB_CONFIGURATION_DESCRIPTOR)Ptr;
-
-        DumpFullConfigurationDescriptor(ConfigDesc);
-        ASSERT(ConfigDesc->wTotalLength <= PAGE_SIZE);
-
-        UsbDevice->Configs[i] = ExAllocatePoolWithTag(NonPagedPool,
-                                                      sizeof(USB_CONFIGURATION) + sizeof(PVOID) * ConfigDesc->bNumInterfaces,
-                                                      USB_POOL_TAG);
-        UsbDevice->Configs[i]->Device = UsbDevice;
-
-        RtlCopyMemory(&UsbDevice->Configs[0]->ConfigurationDescriptor,
-                      ConfigDesc, sizeof(USB_CONFIGURATION_DESCRIPTOR));
-        Ptr += ConfigDesc->bLength;
-
-        for (j = 0; j < ConfigDesc->bNumInterfaces; j++)
-        {
-            InterfaceDesc = (PUSB_INTERFACE_DESCRIPTOR) Ptr;
-            UsbDevice->Configs[i]->Interfaces[j] = ExAllocatePoolWithTag(NonPagedPool,
-                                                                         sizeof(USB_INTERFACE) + sizeof(PVOID) * InterfaceDesc->bNumEndpoints,
-                                                                         USB_POOL_TAG);
-            RtlCopyMemory(&UsbDevice->Configs[i]->Interfaces[j]->InterfaceDescriptor,
-                          InterfaceDesc,
-                          sizeof(USB_INTERFACE_DESCRIPTOR));
-
-            Ptr += InterfaceDesc->bLength;
-
-            for (k = 0; k < InterfaceDesc->bNumEndpoints; k++)
-            {
-                EndpointDesc = (PUSB_ENDPOINT_DESCRIPTOR)Ptr;
-                UsbDevice->Configs[i]->Interfaces[j]->EndPoints[k] = ExAllocatePoolWithTag(NonPagedPool, sizeof(USB_ENDPOINT), USB_POOL_TAG);
-                RtlCopyMemory(&UsbDevice->Configs[i]->Interfaces[j]->EndPoints[k]->EndPointDescriptor,
-                              EndpointDesc, sizeof(USB_ENDPOINT_DESCRIPTOR));
-                Ptr += sizeof(USB_ENDPOINT_DESCRIPTOR);
-            }
-        }
-    }
-
-    UsbDevice->ActiveConfig = UsbDevice->Configs[0];
-    UsbDevice->ActiveInterface = UsbDevice->Configs[0]->Interfaces[0];
-
-    UsbDevice->DeviceState = DEVICEINTIALIZED;
-
-    return STATUS_SUCCESS;
-}
-
-/* Return the descriptors that will fit. Descriptors were saved when the InitializeUsbDevice function was called */
-NTSTATUS
-USB_BUSIFFN
-GetUsbDescriptors(PVOID BusContext,
-                  PUSB_DEVICE_HANDLE DeviceHandle,
-                  PUCHAR DeviceDescriptorBuffer,
-                  PULONG DeviceDescriptorBufferLength,
-                  PUCHAR ConfigDescriptorBuffer,
-                  PULONG ConfigDescriptorBufferLength)
-{
-    PUSB_DEVICE UsbDevice;
-    DPRINT1("Ehci: GetUsbDescriptor %x, %x, %x, %x\n", DeviceDescriptorBuffer, *DeviceDescriptorBufferLength,
-                                                       ConfigDescriptorBuffer, *ConfigDescriptorBufferLength);
-
-    UsbDevice = DeviceHandleToUsbDevice(BusContext, DeviceHandle);
-
-    if (!UsbDevice)
-    {
-        DPRINT1("Invalid DeviceHandle or device not connected\n");
-        return STATUS_DEVICE_NOT_CONNECTED;
-    }
-
-    if ((DeviceDescriptorBuffer) && (DeviceDescriptorBufferLength))
-    {
-        RtlCopyMemory(DeviceDescriptorBuffer, &UsbDevice->DeviceDescriptor, sizeof(USB_DEVICE_DESCRIPTOR));
-        *DeviceDescriptorBufferLength = sizeof(USB_DEVICE_DESCRIPTOR);
-    }
-
-    if ((ConfigDescriptorBuffer) && (ConfigDescriptorBufferLength))
-    {
-        RtlCopyMemory(ConfigDescriptorBuffer, &UsbDevice->ActiveConfig->ConfigurationDescriptor, sizeof(USB_CONFIGURATION_DESCRIPTOR));
-        *ConfigDescriptorBufferLength = sizeof(USB_CONFIGURATION_DESCRIPTOR);
-    }
-
-    return STATUS_SUCCESS;
-}
-
-/* Documented http://www.osronline.com/ddkx/buses/usbinterkr_1m7m.htm */
-NTSTATUS
-USB_BUSIFFN
-RemoveUsbDevice(PVOID BusContext, PUSB_DEVICE_HANDLE DeviceHandle, ULONG Flags)
-{
-    PPDO_DEVICE_EXTENSION PdoDeviceExtension;
-    PUSB_DEVICE UsbDevice;
-    LONG i, j, k;
-
-    DPRINT1("RemoveUsbDevice called, DeviceHandle %x, Flags %x\n", DeviceHandle, Flags);
-
-    PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
-
-    UsbDevice = DeviceHandleToUsbDevice(BusContext, DeviceHandle);
-
-    if (!UsbDevice)
-    {
-        DPRINT1("Invalid DeviceHandle or device not connected\n");
-        return STATUS_DEVICE_NOT_CONNECTED;
-    }
-
-    switch (Flags)
-    {
-       case 0:
-            DPRINT1("Number of Configurations %d\n", UsbDevice->DeviceDescriptor.bNumConfigurations);
-            for (i = 0; i < UsbDevice->DeviceDescriptor.bNumConfigurations; i++)
-            {
-                for (j = 0; j < UsbDevice->Configs[i]->ConfigurationDescriptor.bNumInterfaces; j++)
-                {
-                    for (k = 0; k < UsbDevice->Configs[i]->Interfaces[j]->InterfaceDescriptor.bNumEndpoints; k++)
-                    {
-                        ExFreePool(UsbDevice->Configs[i]->Interfaces[j]->EndPoints[k]);
-                    }
-                    ExFreePool(UsbDevice->Configs[i]->Interfaces[j]);
-                }
-                ExFreePool(UsbDevice->Configs[i]);
-            }
-
-            for (i = 0; i < 127; i++)
-            {
-                if (PdoDeviceExtension->UsbDevices[i] == UsbDevice)
-                    PdoDeviceExtension->UsbDevices[i] = NULL;
-            }
-
-            ExFreePool(UsbDevice);
-            break;
-        case USBD_MARK_DEVICE_BUSY:
-            UsbDevice->DeviceState |= DEVICEBUSY;
-            /* Fall through */
-        case USBD_KEEP_DEVICE_DATA:
-            UsbDevice->DeviceState |= DEVICEREMOVED;
-            break;
-        default:
-            DPRINT1("Unknown Remove Flags %x\n", Flags);
-    }
-    return STATUS_SUCCESS;
-}
-
-/* Documented at http://www.osronline.com/ddkx/buses/usbinterkr_01te.htm */
-NTSTATUS
-USB_BUSIFFN
-RestoreUsbDevice(PVOID BusContext, PUSB_DEVICE_HANDLE OldDeviceHandle, PUSB_DEVICE_HANDLE NewDeviceHandle)
-{
-    PUSB_DEVICE OldUsbDevice;
-    PUSB_DEVICE NewUsbDevice;
-    PUSB_CONFIGURATION ConfigToDelete;
-    int i;
-
-    DPRINT1("Ehci: RestoreUsbDevice %x, %x, %x\n", BusContext, OldDeviceHandle, NewDeviceHandle);
-ASSERT(FALSE);
-    OldUsbDevice = DeviceHandleToUsbDevice(BusContext, OldDeviceHandle);
-    NewUsbDevice = DeviceHandleToUsbDevice(BusContext, NewDeviceHandle);
-
-    if (!OldUsbDevice)
-    {
-        DPRINT1("OldDeviceHandle is invalid\n");
-        return STATUS_DEVICE_NOT_CONNECTED;
-    }
-
-    if (!(OldUsbDevice->DeviceState & DEVICEREMOVED))
-    {
-        DPRINT1("UsbDevice is not marked as Removed!\n");
-        return STATUS_UNSUCCESSFUL;
-    }
-
-    if (!NewUsbDevice)
-    {
-        DPRINT1("NewDeviceHandle is invalid\n");
-        return STATUS_DEVICE_NOT_CONNECTED;
-    }
-
-    if ((OldUsbDevice->DeviceDescriptor.idVendor == NewUsbDevice->DeviceDescriptor.idVendor) &&
-        (OldUsbDevice->DeviceDescriptor.idProduct == NewUsbDevice->DeviceDescriptor.idProduct))
-    {
-        NewUsbDevice->DeviceState &= ~DEVICEBUSY;
-        NewUsbDevice->DeviceState &= ~DEVICEREMOVED;
-
-        NewUsbDevice->ActiveConfig = OldUsbDevice->ActiveConfig;
-        NewUsbDevice->ActiveInterface = OldUsbDevice->ActiveInterface;
-
-        for (i = 0; i < NewUsbDevice->DeviceDescriptor.bNumConfigurations; i++)
-        {
-            ConfigToDelete = NewUsbDevice->Configs[i];
-            ASSERT(OldUsbDevice->Configs[i]);
-            NewUsbDevice->Configs[i] = OldUsbDevice->Configs[i];
-            OldUsbDevice->Configs[i] = ConfigToDelete;
-        }
-
-        RemoveUsbDevice(BusContext, OldDeviceHandle, 0);
-        return STATUS_SUCCESS;
-    }
-    else
-    {
-        DPRINT1("VendorId or ProductId did not match!\n");
-        return STATUS_DEVICE_NOT_CONNECTED;
-    }
-}
-
-/* FIXME: Research this */
-NTSTATUS
-USB_BUSIFFN
-GetPortHackFlags(PVOID BusContext, PULONG Flags)
-{
-    DPRINT1("Ehci: GetPortHackFlags not implemented. %x, %x\n", BusContext, Flags);
-    return STATUS_NOT_SUPPORTED;
-}
-
-NTSTATUS
-USB_BUSIFFN
-QueryDeviceInformation(PVOID BusContext,
-                       PUSB_DEVICE_HANDLE DeviceHandle,
-                       PVOID DeviceInformationBuffer,
-                       ULONG DeviceInformationBufferLength,
-                       PULONG LengthReturned)
-{
-    PUSB_DEVICE_INFORMATION_0 DeviceInfo = DeviceInformationBuffer;
-    PUSB_DEVICE UsbDevice;
-    ULONG SizeNeeded;
-    LONG i;
-
-    DPRINT1("Ehci: QueryDeviceInformation (%x, %x, %x, %d, %x\n", BusContext, DeviceHandle, DeviceInformationBuffer,
-                                                                  DeviceInformationBufferLength, LengthReturned);
-
-    UsbDevice = DeviceHandleToUsbDevice(BusContext, DeviceHandle);
-
-    if (!UsbDevice)
-    {
-        DPRINT1("Invalid DeviceHandle or device not connected\n");
-        return STATUS_DEVICE_NOT_CONNECTED;
-    }
-
-    SizeNeeded = FIELD_OFFSET(USB_DEVICE_INFORMATION_0, PipeList[UsbDevice->ActiveInterface->InterfaceDescriptor.bNumEndpoints]);
-    *LengthReturned = SizeNeeded;
-
-    DeviceInfo->ActualLength = SizeNeeded;
-
-    if (DeviceInformationBufferLength < SizeNeeded)
-    {
-        DPRINT1("Buffer to small\n");
-        return STATUS_BUFFER_TOO_SMALL;
-    }
-
-    if (DeviceInfo->InformationLevel != 0)
-    {
-        DPRINT1("Invalid Param\n");
-        return STATUS_INVALID_PARAMETER;
-    }
-
-    DeviceInfo->HubAddress = 0;
-    DeviceInfo->DeviceAddress = UsbDevice->Address;
-    DeviceInfo->DeviceSpeed = UsbDevice->DeviceSpeed;
-    DeviceInfo->DeviceType = UsbDevice->DeviceType;
-
-    if (!UsbDevice->DeviceState)
-    {
-        DeviceInfo->CurrentConfigurationValue = 0;
-        DeviceInfo->NumberOfOpenPipes = 0;
-        DeviceInfo->PortNumber = 0;
-    }
-    else
-    {
-        DeviceInfo->CurrentConfigurationValue = UsbDevice->ActiveConfig->ConfigurationDescriptor.bConfigurationValue;
-        /* FIXME: Use correct number of open pipes instead of all available */
-        DeviceInfo->NumberOfOpenPipes = UsbDevice->ActiveInterface->InterfaceDescriptor.bNumEndpoints;
-        DeviceInfo->PortNumber = UsbDevice->Port;
-    }
-
-    RtlCopyMemory(&DeviceInfo->DeviceDescriptor, &UsbDevice->DeviceDescriptor, sizeof(USB_DEVICE_DESCRIPTOR));
-
-    for (i = 0; i < UsbDevice->ActiveInterface->InterfaceDescriptor.bNumEndpoints; i++)
-    {
-        RtlCopyMemory(&DeviceInfo->PipeList[i].EndpointDescriptor,
-                      &UsbDevice->ActiveInterface->EndPoints[i]->EndPointDescriptor,
-                      sizeof(USB_ENDPOINT_DESCRIPTOR));
-    }
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS
-USB_BUSIFFN
-GetControllerInformation(PVOID BusContext,
-                         PVOID ControllerInformationBuffer,
-                         ULONG ControllerInformationBufferLength,
-                         PULONG LengthReturned)
-{
-    PUSB_CONTROLLER_INFORMATION_0 ControllerInfo;
-
-    DPRINT1("Ehci: GetControllerInformation called\n");
-
-    if (!LengthReturned)
-        return STATUS_INVALID_PARAMETER;
-
-    ControllerInfo = ControllerInformationBuffer;
-
-    if (ControllerInformationBufferLength < sizeof(USB_CONTROLLER_INFORMATION_0))
-    {
-        DPRINT1("Buffer to small\n");
-        return STATUS_BUFFER_TOO_SMALL;
-    }
-
-    if (ControllerInfo->InformationLevel != 0)
-    {
-        DPRINT1("InformationLevel other than 0 not supported\n");
-        return STATUS_NOT_SUPPORTED;
-    }
-
-    ControllerInfo->ActualLength = sizeof(USB_CONTROLLER_INFORMATION_0);
-    ControllerInfo->SelectiveSuspendEnabled = FALSE;
-    ControllerInfo->IsHighSpeedController = TRUE;
-
-    *LengthReturned = ControllerInfo->ActualLength;
-
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS
-USB_BUSIFFN
-ControllerSelectiveSuspend(PVOID BusContext, BOOLEAN Enable)
-{
-    DPRINT1("Ehci: ControllerSelectiveSuspend not implemented\n");
-    return STATUS_NOT_SUPPORTED;
-}
-
-NTSTATUS
-USB_BUSIFFN
-GetExtendedHubInformation(PVOID BusContext,
-                          PDEVICE_OBJECT HubPhysicalDeviceObject,
-                          PVOID HubInformationBuffer,
-                          ULONG HubInformationBufferLength,
-                          PULONG LengthReturned)
-{
-
-    PUSB_EXTHUB_INFORMATION_0 UsbExtHubInfo = HubInformationBuffer;
-    PPDO_DEVICE_EXTENSION PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
-    PFDO_DEVICE_EXTENSION FdoDeviceExntension = (PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension;
-    LONG i;
-    DPRINT1("Ehci: GetExtendedHubInformation BusContext %x, PDO %x, InformationBuffer %x\n", 
-            BusContext, HubPhysicalDeviceObject, HubInformationBuffer);
-
-    /* Set the default return value */
-    *LengthReturned = 0;
-
-    DPRINT("InformationLevel %x\n", UsbExtHubInfo->InformationLevel);
-
-    /* Caller is suppose to have set InformationLevel to 0. However usbehci from MS seems to ignore this */
-    if (UsbExtHubInfo->InformationLevel != 0)
-    {
-        DPRINT1("InformationLevel should really be set to 0. Ignoring\n");
-    }
-
-    UsbExtHubInfo->NumberOfPorts = FdoDeviceExntension->hcd.ECHICaps.HCSParams.PortCount;
-
-    for (i=0; i < UsbExtHubInfo->NumberOfPorts; i++)
-    {
-        UsbExtHubInfo->Port[i].PhysicalPortNumber = i + 1;
-        UsbExtHubInfo->Port[i].PortLabelNumber = i + 1;
-        UsbExtHubInfo->Port[i].VidOverride = 0;
-        UsbExtHubInfo->Port[i].PidOverride = 0;
-        UsbExtHubInfo->Port[i].PortAttributes = USB_PORTATTR_SHARED_USB2;// | USB_PORTATTR_OWNED_BY_CC;
-    }
-
-    *LengthReturned = FIELD_OFFSET(USB_EXTHUB_INFORMATION_0, Port[8]);
-
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS
-USB_BUSIFFN
-GetRootHubSymbolicName(PVOID BusContext,
-                       PVOID HubSymNameBuffer,
-                       ULONG HubSymNameBufferLength,
-                       PULONG HubSymNameActualLength)
-{
-    DPRINT1("Ehci: GetRootHubSymbolicName called\n");
-
-    if (HubSymNameBufferLength < 16)
-        return STATUS_UNSUCCESSFUL;
-    RtlCopyMemory(HubSymNameBuffer, L"ROOT_HUB", HubSymNameBufferLength);
-    *HubSymNameActualLength = 16;
-
-    return STATUS_SUCCESS;
-}
-
-PVOID
-USB_BUSIFFN
-GetDeviceBusContext(PVOID HubBusContext, PVOID DeviceHandle)
-{
-    PUSB_DEVICE UsbDevice;
-
-    DPRINT1("Ehci: GetDeviceBusContext called\n");
-    UsbDevice = DeviceHandleToUsbDevice(HubBusContext, DeviceHandle);
-
-    if (!UsbDevice)
-    {
-        DPRINT1("Invalid DeviceHandle or device not connected\n");
-        return NULL;
-    }
-
-    return NULL;
-}
-
-NTSTATUS
-USB_BUSIFFN
-Initialize20Hub(PVOID BusContext, PUSB_DEVICE_HANDLE HubDeviceHandle, ULONG TtCount)
-{
-    DPRINT1("Ehci: Initialize20Hub called, HubDeviceHandle: %x, TtCount %x\n", HubDeviceHandle, TtCount);
-    /* FIXME: */
-    /* Create the Irp Queue for SCE */
-    /* Should queue be created for each device or each enpoint??? */
-    return STATUS_SUCCESS;
-}
-
-NTSTATUS
-USB_BUSIFFN
-RootHubInitNotification(PVOID BusContext, PVOID CallbackContext, PRH_INIT_CALLBACK CallbackRoutine)
-{
-    PPDO_DEVICE_EXTENSION PdoDeviceExtension;
-    DPRINT1("Ehci: RootHubInitNotification %x, %x, %x\n", BusContext, CallbackContext, CallbackRoutine);
-
-    PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
-    PdoDeviceExtension->CallbackContext = CallbackContext;
-    PdoDeviceExtension->CallbackRoutine = CallbackRoutine;
-    if (PdoDeviceExtension->CallbackRoutine)
-    {
-        DPRINT1("Called Callbackrountine\n");
-        PdoDeviceExtension->CallbackRoutine(PdoDeviceExtension->CallbackContext);
-        DPRINT1("Done Callbackrountine\n");
-    }
-    else
-    {
-        DPRINT1("PdoDeviceExtension->CallbackRoutine is NULL!\n");
-    }
-
-    return STATUS_SUCCESS;
-}
-
-VOID
-USB_BUSIFFN
-FlushTransfers(PVOID BusContext, PVOID DeviceHandle)
-{
-    PUSB_DEVICE UsbDevice;
-    UsbDevice = DeviceHandleToUsbDevice(BusContext, DeviceHandle);
-
-    if (!UsbDevice)
-    {
-        DPRINT1("Invalid DeviceHandle or device not connected\n");
-    }
-
-    DPRINT1("FlushTransfers not implemented.\n");
-}
-
-VOID
-USB_BUSIFFN
-SetDeviceHandleData(PVOID BusContext, PVOID DeviceHandle, PDEVICE_OBJECT UsbDevicePdo)
-{
-    PUSB_DEVICE UsbDevice;
-    
-    DPRINT1("Ehci: SetDeviceHandleData %x, %x, %x\n", BusContext, DeviceHandle, UsbDevicePdo);
-    UsbDevice = DeviceHandleToUsbDevice(BusContext, DeviceHandle);
-    if (!UsbDevice)
-    {
-        DPRINT1("Invalid DeviceHandle or device not connected\n");
-        return;
-    }    
-    
-    UsbDevice->UsbDevicePdo = UsbDevicePdo;
-}
-
-
-/* USB_BUS_INTERFACE_USBDI_V2 Functions */
-
-VOID
-USB_BUSIFFN
-GetUSBDIVersion(PVOID BusContext, PUSBD_VERSION_INFORMATION VersionInformation, PULONG HcdCapabilites)
-{
-    DPRINT1("Ehci: GetUSBDIVersion called\n");
-    return;
-}
-
-NTSTATUS
-USB_BUSIFFN
-QueryBusTime(PVOID BusContext, PULONG CurrentFrame)
-{
-    DPRINT1("Ehci: QueryBusTime called\n");
-    return STATUS_NOT_SUPPORTED;
-}
-
-NTSTATUS
-USB_BUSIFFN
-SubmitIsoOutUrb(PVOID BusContext, PURB Urb)
-{
-    DPRINT1("Ehci: SubmitIsoOutUrb called\n");
-    return STATUS_NOT_SUPPORTED;
-}
-
-NTSTATUS
-USB_BUSIFFN
-QueryBusInformation(PVOID BusContext,
-                    ULONG Level,
-                    PVOID BusInformationBuffer,
-                    PULONG BusInformationBufferLength,
-                    PULONG BusInformationActualLength)
-{
-    DPRINT1("Ehci: QueryBusInformation called\n");
-    return STATUS_NOT_SUPPORTED;
-}
-
-BOOLEAN
-USB_BUSIFFN
-IsDeviceHighSpeed(PVOID BusContext)
-{
-    DPRINT1("Ehci: IsDeviceHighSpeed called\n");
-    return TRUE;
-}
-
-NTSTATUS
-USB_BUSIFFN
-EnumLogEntry(PVOID BusContext, ULONG DriverTag, ULONG EnumTag, ULONG P1, ULONG P2)
-{
-    DPRINT1("Ehci: EnumLogEntry called %x, %x, %x, %x\n", DriverTag, EnumTag, P1, P2);
-    
-    return STATUS_SUCCESS;
-}
diff --git a/drivers/usb/usbehci/usbiffn.h b/drivers/usb/usbehci/usbiffn.h
deleted file mode 100644 (file)
index eff48f0..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-#pragma once
-
-#include <ntifs.h>
-#include <ntddk.h>
-#include <usb.h>
-#include <usbbusif.h>
-
-PVOID
-InternalCreateUsbDevice(UCHAR DeviceNumber, ULONG Port, PUSB_DEVICE Parent, BOOLEAN Hub);
-
-VOID
-USB_BUSIFFN
-InterfaceReference(PVOID BusContext);
-
-VOID
-USB_BUSIFFN
-InterfaceDereference(PVOID BusContext);
-
-NTSTATUS
-USB_BUSIFFN
-CreateUsbDevice(PVOID BusContext,
-    PUSB_DEVICE_HANDLE *NewDevice,
-    PUSB_DEVICE_HANDLE HubDeviceHandle,
-    USHORT PortStatus, USHORT PortNumber);
-
-NTSTATUS
-USB_BUSIFFN
-InitializeUsbDevice(PVOID BusContext, PUSB_DEVICE_HANDLE DeviceHandle);
-
-NTSTATUS
-USB_BUSIFFN
-GetUsbDescriptors(PVOID BusContext,
-    PUSB_DEVICE_HANDLE DeviceHandle,
-    PUCHAR DeviceDescriptorBuffer,
-    PULONG DeviceDescriptorBufferLength,
-    PUCHAR ConfigDescriptorBuffer,
-    PULONG ConfigDescriptorBufferLength);
-
-NTSTATUS
-USB_BUSIFFN
-RemoveUsbDevice(PVOID BusContext, PUSB_DEVICE_HANDLE DeviceHandle, ULONG Flags);
-
-NTSTATUS
-USB_BUSIFFN
-RestoreUsbDevice(PVOID BusContext, PUSB_DEVICE_HANDLE OldDeviceHandle, PUSB_DEVICE_HANDLE NewDeviceHandle);
-
-NTSTATUS
-USB_BUSIFFN
-GetPortHackFlags(PVOID BusContext, PULONG Flags);
-
-NTSTATUS
-USB_BUSIFFN
-QueryDeviceInformation(PVOID BusContext,
-                       PUSB_DEVICE_HANDLE DeviceHandle,
-                       PVOID DeviceInformationBuffer,
-                       ULONG DeviceInformationBufferLength,
-                       PULONG LengthReturned);
-
-NTSTATUS
-USB_BUSIFFN
-GetControllerInformation(PVOID BusContext,
-                         PVOID ControllerInformationBuffer,
-                         ULONG ControllerInformationBufferLength,
-                         PULONG LengthReturned);
-
-NTSTATUS
-USB_BUSIFFN
-ControllerSelectiveSuspend(PVOID BusContext, BOOLEAN Enable);
-
-NTSTATUS
-USB_BUSIFFN
-GetExtendedHubInformation(PVOID BusContext,
-                          PDEVICE_OBJECT HubPhysicalDeviceObject,
-                          PVOID HubInformationBuffer,
-                          ULONG HubInformationBufferLength,
-                          PULONG LengthReturned);
-
-NTSTATUS
-USB_BUSIFFN
-GetRootHubSymbolicName(PVOID BusContext,
-                       PVOID HubSymNameBuffer,
-                       ULONG HubSymNameBufferLength,
-                       PULONG HubSymNameActualLength);
-
-PVOID
-USB_BUSIFFN
-GetDeviceBusContext(PVOID HubBusContext, PVOID DeviceHandle);
-
-NTSTATUS
-USB_BUSIFFN
-Initialize20Hub(PVOID BusContext, PUSB_DEVICE_HANDLE HubDeviceHandle, ULONG TtCount);
-
-NTSTATUS
-USB_BUSIFFN
-RootHubInitNotification(PVOID BusContext, PVOID CallbackContext, PRH_INIT_CALLBACK CallbackRoutine);
-
-VOID
-USB_BUSIFFN
-FlushTransfers(PVOID BusContext, PVOID DeviceHandle);
-
-VOID
-USB_BUSIFFN
-SetDeviceHandleData(PVOID BusContext, PVOID DeviceHandle, PDEVICE_OBJECT UsbDevicePdo);
-
-VOID
-USB_BUSIFFN
-GetUSBDIVersion(PVOID BusContext, PUSBD_VERSION_INFORMATION VersionInformation, PULONG HcdCapabilites);
-
-NTSTATUS
-USB_BUSIFFN
-QueryBusTime(PVOID BusContext, PULONG CurrentFrame);
-
-NTSTATUS
-USB_BUSIFFN
-SubmitIsoOutUrb(PVOID BusContext, PURB Urb);
-
-NTSTATUS
-USB_BUSIFFN
-QueryBusInformation(PVOID BusContext,
-                    ULONG Level,
-                    PVOID BusInformationBuffer,
-                    PULONG BusInformationBufferLength,
-                    PULONG BusInformationActualLength);
-
-BOOLEAN
-USB_BUSIFFN
-IsDeviceHighSpeed(PVOID BusCOntext);
-
-NTSTATUS
-USB_BUSIFFN
-EnumLogEntry(PVOID BusContext, ULONG DriverTag, ULONG EnumTag, ULONG P1, ULONG P2);
diff --git a/drivers/usb/usbhub/createclose.c b/drivers/usb/usbhub/createclose.c
deleted file mode 100644 (file)
index e00c8be..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         USB hub driver
- * FILE:            drivers/usb/cromwell/usbhub/createclose.c
- * PURPOSE:         IRP_MJ_CREATE and IRP_MJ_CLOSE operations
- *
- * PROGRAMMERS:     Hervé Poussineau (hpoussin@reactos.com)
- */
-
-#define NDEBUG
-#include "usbhub.h"
-
-NTSTATUS NTAPI
-UsbhubCreate(
-       IN PDEVICE_OBJECT DeviceObject,
-       IN PIRP Irp)
-{
-       DPRINT("Usbhub: IRP_MJ_CREATE\n");
-
-       Irp->IoStatus.Status = STATUS_SUCCESS;
-       Irp->IoStatus.Information = 0;
-       IoCompleteRequest(Irp, IO_NO_INCREMENT);
-       return STATUS_SUCCESS;
-}
-
-NTSTATUS NTAPI
-UsbhubClose(
-       IN PDEVICE_OBJECT DeviceObject,
-       IN PIRP Irp)
-{
-       DPRINT("Usbhub: IRP_MJ_CLOSE\n");
-
-       Irp->IoStatus.Status = STATUS_SUCCESS;
-       Irp->IoStatus.Information = 0;
-       IoCompleteRequest(Irp, IO_NO_INCREMENT);
-       return STATUS_SUCCESS;
-}
-
-NTSTATUS NTAPI
-UsbhubCleanup(
-       IN PDEVICE_OBJECT DeviceObject,
-       IN PIRP Irp)
-{
-       DPRINT("Usbhub: IRP_MJ_CLEANUP\n");
-
-       Irp->IoStatus.Status = STATUS_SUCCESS;
-       Irp->IoStatus.Information = 0;
-       IoCompleteRequest(Irp, IO_NO_INCREMENT);
-       return STATUS_SUCCESS;
-}