Delete useless utils:
authorHervé Poussineau <hpoussin@reactos.org>
Tue, 11 Apr 2006 22:10:41 +0000 (22:10 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Tue, 11 Apr 2006 22:10:41 +0000 (22:10 +0000)
patchnv4: Tries to patch the nVidia NT4 driver, which doesn't work anymore (we now report Windows 2000)
dumprecbin: Dumps the contents of the recycle bin. Has been replaced by a recycle bin library at revision 21553

svn path=/trunk/; revision=21558

reactos/base/applications/utils/dumprecbin/dumprecbin.c [deleted file]
reactos/base/applications/utils/dumprecbin/dumprecbin.rbuild [deleted file]
reactos/base/applications/utils/patchnv4/nv4_howto.html [deleted file]
reactos/base/applications/utils/patchnv4/patchnv4.c [deleted file]

diff --git a/reactos/base/applications/utils/dumprecbin/dumprecbin.c b/reactos/base/applications/utils/dumprecbin/dumprecbin.c
deleted file mode 100644 (file)
index c317e83..0000000
+++ /dev/null
@@ -1,733 +0,0 @@
-/* 
- *
- *  dumprecbin - dumps a recycle bin database
- *
- *  Copyright (c) 2005 by Thomas Weidenmueller <w3seek@reactos.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * TODO: - Support for Vista recycle bins (read the DeleteInfo NTFS streams, also NT 5.x)
- *       - Support for INFO databases (win95)
- */
-#include <windows.h>
-#include <winternl.h>
-#include <sddl.h>
-#include <ntsecapi.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <tchar.h>
-
-#ifndef NT_SUCCESS
-#define NT_SUCCESS(status) ((LONG)(status) >= 0)
-#endif
-
-typedef struct _RECYCLE_BIN
-{
-    struct _RECYCLE_BIN *Next;
-    PSID Sid;
-    WCHAR User[255];
-    WCHAR Path[MAX_PATH + 1];
-} RECYCLE_BIN, *PRECYCLE_BIN;
-
-typedef enum
-{
-    ivUnknown = 0,
-    ivINFO2
-} INFO_VERSION, *PINFO_VERSION;
-
-typedef struct _INFO2_HEADER
-{
-    DWORD Version;
-    DWORD Zero1;
-    DWORD Zero2;
-    DWORD RecordSize;
-} INFO2_HEADER, *PINFO2_HEADER;
-
-typedef struct _INFO2_RECORD
-{
-    DWORD Unknown;
-    CHAR AnsiFileName[MAX_PATH];
-    DWORD RecordNumber;
-    DWORD DriveLetter;
-    FILETIME DeletionTime;
-    DWORD DeletedPhysicalSize;
-    WCHAR FileName[MAX_PATH - 2];
-} INFO2_RECORD, *PINFO2_RECORD;
-
-static HANDLE
-OpenAndMapInfoDatabase(IN LPTSTR szFileName,
-                       OUT PVOID *MappingBasePtr,
-                       OUT PLARGE_INTEGER FileSize)
-{
-    HANDLE hFile, hMapping = INVALID_HANDLE_VALUE;
-
-    hFile = CreateFile(szFileName,
-                       FILE_READ_DATA,
-                       FILE_SHARE_READ,
-                       NULL,
-                       OPEN_EXISTING,
-                       FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM,
-                       NULL);
-    if (hFile != INVALID_HANDLE_VALUE)
-    {
-        if (GetFileSizeEx(hFile,
-                          FileSize) &&
-            FileSize->QuadPart >= 0xF)
-        {
-            hMapping = CreateFileMapping(hFile,
-                                         NULL,
-                                         PAGE_READONLY,
-                                         0,
-                                         0,
-                                         NULL);
-            if (hMapping == NULL ||
-                !(*MappingBasePtr = MapViewOfFile(hMapping,
-                                                  FILE_MAP_READ,
-                                                  0,
-                                                  0,
-                                                  0)))
-            {
-                if (hMapping != NULL)
-                {
-                    CloseHandle(hMapping);
-                }
-                hMapping = INVALID_HANDLE_VALUE;
-            }
-        }
-        CloseHandle(hFile);
-    }
-    
-    return hMapping;
-}
-
-static VOID
-UnmapAndCloseDatabase(IN HANDLE hMapping,
-                      IN PVOID MappingBasePtr)
-{
-    UnmapViewOfFile(MappingBasePtr);
-    CloseHandle(hMapping);
-}
-
-static INFO_VERSION
-DetectDatabaseVersion(PVOID Header)
-{
-    PINFO2_HEADER Info2 = (PINFO2_HEADER)Header;
-    INFO_VERSION Version = ivUnknown;
-
-    if (Info2->Version == 5 &&
-        Info2->Zero1 == 0 &&
-        Info2->Zero2 == 0 &&
-        Info2->RecordSize == 0x320)
-    {
-        Version = ivINFO2;
-    }
-    
-    return Version;
-}
-
-static BOOL
-IsValidRecycleBin(IN LPTSTR szPath)
-{
-    TCHAR szFile[MAX_PATH + 1];
-    TCHAR szClsId[48];
-    INFO_VERSION DbVersion = ivUnknown;
-    
-    _stprintf(szFile,
-              _T("%s\\desktop.ini"),
-              szPath);
-
-    /* check if directory contains a valid desktop.ini for the recycle bin */
-    if (GetPrivateProfileString(TEXT(".ShellClassInfo"),
-                                TEXT("CLSID"),
-                                NULL,
-                                szClsId,
-                                sizeof(szClsId) / sizeof(szClsId[0]),
-                                szFile) &&
-        !_tcsicmp(_T("{645FF040-5081-101B-9F08-00AA002F954E}"),
-                  szClsId))
-    {
-        HANDLE hDb;
-        LARGE_INTEGER FileSize;
-        PVOID pDbBase = NULL;
-
-        /* open the database and check the signature */
-        _stprintf(szFile,
-                  _T("%s\\INFO2"),
-                  szPath);
-        hDb = OpenAndMapInfoDatabase(szFile,
-                                     &pDbBase,
-                                     &FileSize);
-        if (hDb != INVALID_HANDLE_VALUE)
-        {
-            DbVersion = DetectDatabaseVersion(pDbBase);
-            UnmapAndCloseDatabase(hDb,
-                                  pDbBase);
-        }
-    }
-
-    return DbVersion != ivUnknown;
-}
-
-static BOOL
-OpenLocalLSAPolicyHandle(IN ACCESS_MASK DesiredAccess,
-                         OUT PLSA_HANDLE PolicyHandle)
-{
-    LSA_OBJECT_ATTRIBUTES LsaObjectAttributes = {0};
-    NTSTATUS Status;
-
-    Status = LsaOpenPolicy(NULL,
-                           &LsaObjectAttributes,
-                           DesiredAccess,
-                           PolicyHandle);
-    if (!NT_SUCCESS(Status))
-    {
-        SetLastError(LsaNtStatusToWinError(Status));
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
-static BOOL
-ConvertSIDToAccountName(IN PSID Sid,
-                        OUT LPWSTR User)
-{
-    DWORD AccountNameLen = 0;
-    DWORD DomainNameLen = 0;
-    SID_NAME_USE NameUse;
-    DWORD Error = ERROR_SUCCESS;
-    LPWSTR AccountName, DomainName;
-    BOOL Ret = FALSE;
-
-    if (!LookupAccountSidW(NULL,
-                           Sid,
-                           NULL,
-                           &AccountNameLen,
-                           NULL,
-                           &DomainNameLen,
-                           &NameUse))
-    {
-        Error = GetLastError();
-        if (Error == ERROR_NONE_MAPPED ||
-            Error != ERROR_INSUFFICIENT_BUFFER)
-        {
-            /* some unexpected error occured! */
-            goto ConvertSID;
-        }
-    }
-    
-    AccountName = (LPWSTR)HeapAlloc(GetProcessHeap(),
-                                    0,
-                                    (AccountNameLen + DomainNameLen) * sizeof(WCHAR));
-    if (AccountName != NULL)
-    {
-        LSA_HANDLE PolicyHandle;
-        DomainName = AccountName + AccountNameLen;
-        
-        if (!LookupAccountSidW(NULL,
-                               Sid,
-                               AccountName,
-                               &AccountNameLen,
-                               DomainName,
-                               &DomainNameLen,
-                               &NameUse))
-        {
-            goto BailFreeAccountName;
-        }
-        
-        wcscpy(User,
-               AccountName);
-        Ret = TRUE;
-        
-        if (OpenLocalLSAPolicyHandle(POLICY_LOOKUP_NAMES | POLICY_VIEW_LOCAL_INFORMATION,
-                                     &PolicyHandle))
-        {
-            PLSA_REFERENCED_DOMAIN_LIST ReferencedDomain;
-            PLSA_TRANSLATED_NAME Names;
-            PLSA_TRUST_INFORMATION Domain;
-            PLSA_UNICODE_STRING DomainName;
-            PPOLICY_ACCOUNT_DOMAIN_INFO PolicyAccountDomainInfo = NULL;
-            NTSTATUS Status;
-            
-            Status = LsaLookupSids(PolicyHandle,
-                                   1,
-                                   &Sid,
-                                   &ReferencedDomain,
-                                   &Names);
-            if (NT_SUCCESS(Status))
-            {
-                if (ReferencedDomain != NULL &&
-                    Names->DomainIndex >= 0)
-                {
-                    Domain = &ReferencedDomain->Domains[Names->DomainIndex];
-                    DomainName = &Domain->Name;
-                }
-                else
-                {
-                    Domain = NULL;
-                    DomainName = NULL;
-                }
-                
-                switch (Names->Use)
-                {
-                    case SidTypeAlias:
-                        if (Domain != NULL)
-                        {
-                            /* query the domain name for BUILTIN accounts */
-                            Status = LsaQueryInformationPolicy(PolicyHandle,
-                                                               PolicyAccountDomainInformation,
-                                                               (PVOID*)&PolicyAccountDomainInfo);
-                            if (NT_SUCCESS(Status))
-                            {
-                                DomainName = &PolicyAccountDomainInfo->DomainName;
-                            }
-                        }
-                        /* fall through */
-
-                    case SidTypeUser:
-                    {
-                        if (Domain != NULL)
-                        {
-                            WCHAR *s;
-
-                            /* NOTE: LSA_UNICODE_STRINGs are not always NULL-terminated! */
-
-                            wcscpy(User,
-                                   AccountName);
-                            wcscat(User,
-                                   L" (");
-                            s = User + wcslen(User);
-                            CopyMemory(s,
-                                       DomainName->Buffer,
-                                       DomainName->Length);
-                            s += DomainName->Length / sizeof(WCHAR);
-                            *(s++) = L'\\';
-                            CopyMemory(s,
-                                       Names->Name.Buffer,
-                                       Names->Name.Length);
-                            s += Names->Name.Length / sizeof(WCHAR);
-                            *(s++) = L')';
-                            *s = L'\0';
-                        }
-                        break;
-                    }
-
-                    case SidTypeWellKnownGroup:
-                    {
-                        break;
-                    }
-
-                    default:
-                    {
-                        _ftprintf(stderr,
-                                  _T("Unhandled SID type: 0x%x\n"),
-                                  Names->Use);
-                        break;
-                    }
-                }
-
-                if (PolicyAccountDomainInfo != NULL)
-                {
-                    LsaFreeMemory(PolicyAccountDomainInfo);
-                }
-
-                LsaFreeMemory(ReferencedDomain);
-                LsaFreeMemory(Names);
-            }
-
-            LsaClose(PolicyHandle);
-            
-            if (!NT_SUCCESS(Status))
-            {
-                Ret = FALSE;
-                goto BailFreeAccountName;
-            }
-        }
-        else
-        {
-BailFreeAccountName:
-            HeapFree(GetProcessHeap(),
-                     0,
-                     AccountName);
-            goto ConvertSID;
-        }
-    }
-    
-ConvertSID:
-    if (!Ret)
-    {
-        LPWSTR StrSid;
-        Ret = ConvertSidToStringSidW(Sid,
-                                     &StrSid);
-        if (Ret)
-        {
-            wcscpy(User,
-                   StrSid);
-            LocalFree((HLOCAL)StrSid);
-        }
-    }
-
-    return Ret;
-}
-
-static VOID
-FreeRecycleBinsList(IN OUT PRECYCLE_BIN *RecycleBinsListHead)
-{
-    PRECYCLE_BIN CurrentBin, NextBin;
-
-    CurrentBin = *RecycleBinsListHead;
-    while (CurrentBin != NULL)
-    {
-        NextBin = CurrentBin->Next;
-        LocalFree((HLOCAL)CurrentBin->Sid);
-        HeapFree(GetProcessHeap(),
-                 0,
-                 CurrentBin);
-        CurrentBin = NextBin;
-    }
-
-    *RecycleBinsListHead = NULL;
-}
-
-static BOOL
-LocateRecycleBins(IN LPWSTR szDrive,
-                  OUT PRECYCLE_BIN *RecycleBinsListHead)
-{
-    TCHAR szRecBinPath[MAX_PATH + 1];
-    HANDLE FindResult;
-    WIN32_FIND_DATA FindData;
-    PRECYCLE_BIN NewBin;
-    BOOL Ret = FALSE;
-    
-    FreeRecycleBinsList(RecycleBinsListHead);
-    
-    /*
-     * search for recycle bins on volumes that support file security (NTFS)
-     */
-    _stprintf(szRecBinPath,
-              _T("%lS\\RECYCLER\\*"),
-              szDrive);
-    FindResult = FindFirstFile(szRecBinPath,
-                               &FindData);
-    if (FindResult != INVALID_HANDLE_VALUE)
-    {
-        do
-        {
-            if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
-                _tcscmp(FindData.cFileName,
-                        _T("..")) &&
-                _tcscmp(FindData.cFileName,
-                        _T(".")))
-            {
-                PSID Sid;
-                
-                if (ConvertStringSidToSid(FindData.cFileName,
-                                          &Sid))
-                {
-                    _stprintf(szRecBinPath,
-                              _T("%s\\RECYCLER\\%s"),
-                              szDrive,
-                              FindData.cFileName);
-                    if (IsValidRecycleBin(szRecBinPath))
-                    {
-                        NewBin = (PRECYCLE_BIN)HeapAlloc(GetProcessHeap(),
-                                                         HEAP_ZERO_MEMORY,
-                                                         sizeof(RECYCLE_BIN));
-                        if (NewBin != NULL)
-                        {
-                            _tcscpy(NewBin->Path,
-                                    szRecBinPath);
-
-                            /* convert the SID to an account name */
-                            ConvertSIDToAccountName(Sid,
-                                                    NewBin->User);
-
-                            /* append the recycle bin */
-                            *RecycleBinsListHead = NewBin;
-                            RecycleBinsListHead = &NewBin->Next;
-                            
-                            Ret = TRUE;
-                        }
-                        else
-                            goto ContinueFreeSid;
-                    }
-                    else
-                    {
-ContinueFreeSid:
-                        LocalFree((HLOCAL)Sid);
-                    }
-                }
-            }
-        } while (FindNextFile(FindResult,
-                              &FindData));
-
-        FindClose(FindResult);
-    }
-    
-    /*
-     * search for recycle bins on volumes that don't support file security (FAT)
-     */
-    _stprintf(szRecBinPath,
-              _T("%s\\Recycled"),
-              szDrive);
-    FindResult = FindFirstFile(szRecBinPath,
-                               &FindData);
-    if (FindResult != INVALID_HANDLE_VALUE)
-    {
-        if (IsValidRecycleBin(szRecBinPath))
-        {
-            SID_IDENTIFIER_AUTHORITY WorldSia = {SECURITY_WORLD_SID_AUTHORITY};
-            PSID EveryoneSid;
-            
-            /* create an Everyone SID */
-            if (AllocateAndInitializeSid(&WorldSia,
-                                         1,
-                                         SECURITY_WORLD_RID,
-                                         0,
-                                         0,
-                                         0,
-                                         0,
-                                         0,
-                                         0,
-                                         0,
-                                         &EveryoneSid))
-            {
-                NewBin = (PRECYCLE_BIN)HeapAlloc(GetProcessHeap(),
-                                                 HEAP_ZERO_MEMORY,
-                                                 sizeof(RECYCLE_BIN));
-                if (NewBin != NULL)
-                {
-                    _tcscpy(NewBin->Path,
-                            szRecBinPath);
-
-                    /* convert the SID to an account name */
-                    ConvertSIDToAccountName(EveryoneSid,
-                                            NewBin->User);
-
-                    /* append the recycle bin */
-                    *RecycleBinsListHead = NewBin;
-                    RecycleBinsListHead = &NewBin->Next;
-
-                    Ret = TRUE;
-                }
-                else
-                    FreeSid(EveryoneSid);
-            }
-        }
-        FindClose(FindResult);
-    }
-
-    return Ret;
-}
-
-static VOID
-DiskFileNameFromRecord(OUT LPTSTR szShortFileName,
-                       IN DWORD RecordNumber,
-                       IN WCHAR cDriveLetter,
-                       IN LPWSTR szFileName)
-{
-    LPWSTR FileExt;
-    
-    FileExt = wcsrchr(szFileName,
-                      L'.');
-    if (FileExt != NULL)
-    {
-        _stprintf(szShortFileName,
-                  _T("D%lC%d%lS"),
-                  cDriveLetter,
-                  RecordNumber,
-                  FileExt);
-    }
-    else
-    {
-        _stprintf(szShortFileName,
-                  _T("D%lC%d"),
-                  cDriveLetter,
-                  RecordNumber);
-    }
-}
-
-static BOOL
-DumpRecycleBin(IN PRECYCLE_BIN RecycleBin)
-{
-    WCHAR szFile[MAX_PATH + 1];
-    HANDLE hDb;
-    LARGE_INTEGER FileSize;
-    PVOID pDbBase = NULL;
-    INFO_VERSION Version = ivUnknown;
-
-    _tprintf(_T("Dumping recycle bin of \"%lS\":\n"),
-             RecycleBin->User);
-    _tprintf(_T("Directory: %lS\n\n"),
-             RecycleBin->Path);
-
-    _stprintf(szFile,
-              _T("%s\\INFO2"),
-              RecycleBin->Path);
-    hDb = OpenAndMapInfoDatabase(szFile,
-                                 &pDbBase,
-                                 &FileSize);
-    if (hDb != INVALID_HANDLE_VALUE)
-    {
-        Version = DetectDatabaseVersion(pDbBase);
-
-        /* dump the INFO2 database */
-        switch (Version)
-        {
-            case ivINFO2:
-            {
-                DWORD nRecords;
-                PINFO2_HEADER Info2Header = (PINFO2_HEADER)pDbBase;
-                PINFO2_RECORD Info2 = (PINFO2_RECORD)(Info2Header + 1);
-                int i = 0;
-
-                nRecords = (FileSize.QuadPart - sizeof(INFO2_HEADER)) / Info2Header->RecordSize;
-                
-                while (nRecords != 0)
-                {
-                    /* if the first character of the AnsiFileName is zero, the record
-                       is considered deleted */
-                    if (Info2->AnsiFileName[0] != '\0')
-                    {
-                        _tprintf(_T(" [%d] Record: #%d \"%lS\"\n"),
-                                 ++i,
-                                 Info2->RecordNumber,
-                                 Info2->FileName);
-
-                        DiskFileNameFromRecord(szFile,
-                                               Info2->RecordNumber,
-                                               (WCHAR)Info2->DriveLetter + L'a',
-                                               Info2->FileName);
-                        _tprintf(_T("      Name on disk: \"%s\"\n"),
-                                 szFile);
-                        _tprintf(_T("      Deleted size on disk: %d KB\n"),
-                                 Info2->DeletedPhysicalSize / 1024);
-                    }
-                    nRecords--;
-                    Info2++;
-                }
-                
-                break;
-            }
-
-            default:
-                break;
-        }
-
-        UnmapAndCloseDatabase(hDb,
-                              pDbBase);
-    }
-
-    return FALSE;
-}
-
-static BOOL
-SelectRecycleBin(IN LPWSTR szDrive)
-{
-    BOOL Ret;
-    PRECYCLE_BIN RecycleBinsList = NULL;
-    
-    Ret = LocateRecycleBins(szDrive,
-                            &RecycleBinsList);
-    if (Ret)
-    {
-        if (RecycleBinsList->Next != NULL)
-        {
-            PRECYCLE_BIN CurrentBin = RecycleBinsList;
-            int n = 0, i = 0;
-
-            /* if there are multiple recycle bins ask the user which one to dump */
-            _tprintf(_T("There are several recycle bins on this drive. Select one:\n"));
-            
-            while (CurrentBin != NULL)
-            {
-                _tprintf(_T("  [%d] %lS\n"),
-                         ++i,
-                         CurrentBin->User);
-                CurrentBin = CurrentBin->Next;
-                n++;
-            }
-
-            _tprintf(_T("Enter the number: "));
-DisplayPrompt:
-            _tscanf(_T("%d"),
-                    &i);
-            if (i > n || i < 1)
-            {
-                _tprintf(_T("Please enter a number between 1 and %d: "),
-                         n);
-                goto DisplayPrompt;
-            }
-            
-            /* walk to the selected recycle bin */
-            CurrentBin = RecycleBinsList;
-            while (CurrentBin != NULL && i != 1)
-            {
-                CurrentBin = CurrentBin->Next;
-                i--;
-            }
-            
-            /* dump it */
-            Ret = DumpRecycleBin(CurrentBin);
-        }
-        else
-        {
-            /* dump the first (and only) recycle bin */
-            Ret = DumpRecycleBin(RecycleBinsList);
-        }
-    }
-    else
-    {
-        _ftprintf(stderr,
-                  _T("No recycle bins on this volume!\n"));
-    }
-    
-    FreeRecycleBinsList(&RecycleBinsList);
-
-    return Ret;
-}
-
-static VOID
-PrintHelp(VOID)
-{
-    _ftprintf(stderr,
-              _T("Usage: dumprecbin C:\n"));
-}
-
-int
-main(int argc,
-     char *argv[])
-{
-    if (argc != 2 ||
-        strlen(argv[1]) != 2 || argv[1][1] != ':' ||
-        toupper(argv[1][0]) < 'A' || toupper(argv[1][0]) > 'Z')
-    {
-        PrintHelp();
-        return 1;
-    }
-    else
-    {
-        WCHAR szDrive[3];
-        _stprintf(szDrive,
-                  _T("%lC:"),
-                  argv[1][0]);
-
-        if (!SelectRecycleBin(szDrive))
-            return 1;
-        else
-            return 0;
-    }
-}
-
diff --git a/reactos/base/applications/utils/dumprecbin/dumprecbin.rbuild b/reactos/base/applications/utils/dumprecbin/dumprecbin.rbuild
deleted file mode 100644 (file)
index c72d5d5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<module name="dumprecbin" type="win32cui" installbase="bin" installname="dumprecbin.exe">
-       <include base="dumprecbin">.</include>
-       <define name="__USE_W32API" />
-       <define name="UNICODE" />
-       <define name="_UNICODE" />
-       <define name="_WIN32_IE">0x0500</define>
-       <define name="_WIN32_WINNT">0x0600</define>
-       <define name="WINVER">0x0600</define>
-       <library>advapi32</library>
-       <library>kernel32</library>
-       <library>ntdll</library>
-       <file>dumprecbin.c</file>
-</module>
\ No newline at end of file
diff --git a/reactos/base/applications/utils/patchnv4/nv4_howto.html b/reactos/base/applications/utils/patchnv4/nv4_howto.html
deleted file mode 100644 (file)
index 31d0bd0..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-<!-- $Id$ -->
-<HTML>
-<HEAD>
-<TITLE>Using NVidia drivers on ReactOS How-to</TITLE>
-</HEAD>
-<BODY>
-<CENTER><H1>Using NVidia drivers on ReactOS How-to</H1></CENTER>
-
-<H2>1. Introduction</H2>
-There is little support for changing video drivers (or any other driver for that
-matter) in ReactOS at the moment. You have to know how to access the CVS repository
-and how to compile (simple) programs. If this is too complicated, please wait a few
-months, we should have better installation tools then.
-
-<H2>2. Supported hardware</H2>
-The NVidia drivers were tested on the following video card:
-<UL>
-<LI>NVidia Riva TNT2 Model 64</LI>
-<LI>NVidia GeForce4 MX400</LI>
-</UL>
-However, according to the NVidia website, the same driver supports a whole series
-of video cards. If you find this driver works under ReactOS with other cards, please
-let us know on the <A HREF="mailto:ros-general@reactos.com">ros-general mailing list</A>
-
-<H2>3. Download the drivers</H2>
-First, go to the NVidia website, <A HREF="http://www.nvidia.com">www.nvidia.com</A>,
-choose "DOWNLOAD&nbsp;DRIVERS" from the menu at the top of the page (and
-"Download&nbsp;Drivers" again from the drop-down menu). Choose "Graphics&nbsp;Driver"
-in the first box, "GeForce&nbsp;and&nbsp;TNT2" in the second box and "Windows&nbsp;NT4"
-in the third box, then click "Go!". This How-to assumes you see a page identifying the
-driver you are about to download as version 43.45, release on April&nbsp;10, 2003.
-Download the English version.<BR>
-(<A HREF="http://www.nvidia.com/object/winnt_43.45">This</A> is a direct link to the
-download page.)
-
-<H2>4. Unpack the drivers</H2>
-Start the file you just downloaded (note: you need to do this on a MS-Windows computer,
-doesn't work on ReactOS yet). It will ask you for a directory where to save the files.
-You can accept the default of C:\NVIDIA\WinNT4\43.45 or change it to your liking, just
-remember where you put them.... After the files are unpacked, the install wizard will
-start. Just press "Cancel" on the Welcome screen and tell the thing that, yes, you
-are quite sure you want to cancel the installation.<BR>
-Open a Command Prompt window and cd to C:\NVIDIA\WinNT4\43.45 (or wherever you put
-the files). You should have a nv4_mini.sy_ and a nv4_disp.dl_ file. Issue the following
-commands:
-<PRE>
-expand nv4_mini.sy_ nv4_mini.sys
-expand nv4_disp.dl_ nv4_disp.dll
-</PRE>
-After this, you should have a nv4_mini.sys file of 1511936 bytes and a nv4_disp.dll file
-of 569807 bytes.
-
-<H2>5. Patch the miniport driver</H2>
-Since ReactOS is not 100% binary compatible with MS-Windows yet, the miniport driver
-(nv4_mini.sys) needs to be patched. There is a small patch program in the ReactOS CVS
-tree at reactos/apps/utils/patchnv4 which you need to compile. Copy the patchnv4.exe
-to the directory where you have your nv4_mini.sys file and run it. Afterwards, you
-should have a nv4_mini.sys.orig (the original) and a nv4_mini.sys (the patched
-version).<BR>
-Note that we're working towards binary compatibility, so if you're not reading this
-on the <A HREF="http://www.reactos.com">ReactOS website</A>, please go there and check
-if the patching is still necessary (ReactOS might have been fixed...).
-
-<H2>6. Install the drivers</H2>
-The first step is simple, copy the (patched) nv4_mini.sys file to \ReactOS\System32\drivers
-and the nv4_disp.dll file to \ReactOS\System32. The second step is to update the
-registry to actually load the driver. Check out the CVS tree and edit the file
-reactos/bootdata/hivesys.inf. Add the following lines:
-<PRE>
-; NVidia driver
-HKLM,"SYSTEM\CurrentControlSet\Services\nv4","ErrorControl",0x00010001,0x00000000
-HKLM,"SYSTEM\CurrentControlSet\Services\nv4","Group",0x00000000,"Video"
-HKLM,"SYSTEM\CurrentControlSet\Services\nv4","ImagePath",0x00020000,"system32\drivers\nv4_mini.sys"
-HKLM,"SYSTEM\CurrentControlSet\Services\nv4","Start",0x00010001,0x00000004
-HKLM,"SYSTEM\CurrentControlSet\Services\nv4","Type",0x00010001,0x00000001
-HKLM,"SYSTEM\CurrentControlSet\Services\nv4\Device0","CapabilityOverride",0x00010001,0x00000000
-HKLM,"SYSTEM\CurrentControlSet\Services\nv4\Device0","EnableVia4x",0x00010001,0x00000001
-HKLM,"SYSTEM\CurrentControlSet\Services\nv4\Device0","InstalledDisplayDrivers",0x00010000,"nv4_disp"
-HKLM,"SYSTEM\CurrentControlSet\Services\nv4\Device0","NVREGSWITCHES",0x00000001,43,52,54,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,36,34,30,2c,34,38,30,2c,38,2c,36,30,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,36,34,30,2c,34,38,30,2c,38,\
-  2c,36,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,36,34,30,2c,\
-  34,38,30,2c,38,2c,36,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,36,34,30,2c,34,38,30,2c,38,2c,36,30,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,36,34,30,2c,34,38,30,2c,38,2c,36,30,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,36,34,30,2c,34,38,30,2c,38,2c,36,30,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,36,34,30,2c,34,38,30,2c,38,\
-  2c,36,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,36,34,30,2c,\
-  34,38,30,2c,38,2c,36,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,36,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,36,30,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,36,30,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,36,30,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,44,4d,54,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
-  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,00,00,00,01,00,\
-  00,00,00,04,00,00,40,00,00,00,00,04,00,00,00,06,00,00,00,00,00,00,01,00,00,\
-  00,00,00,00,00,00,00,00,00,05,00,00,00,00,00,04,00,00,00,50,00,00,00,01,00,\
-  00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,99,99,99,99,99,\
-  99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,00,00,\
-  00,00
-HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\nv4\Device0","Attach.ToDesktop",0x00010001,1
-HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\nv4\Device0","Attach.RelativeX",0x00010001,0
-HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\nv4\Device0","Attach.RelativeY",0x00010001,0
-HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\nv4\Device0","DefaultSettings.BitsPerPel",0x00010001,16
-HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\nv4\Device0","DefaultSettings.XResolution",0x00010001,1152
-HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\nv4\Device0","DefaultSettings.YResolution",0x00010001,864
-HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\nv4\Device0","DefaultSettings.VRefresh",0x00010001,85
-HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\nv4\Device0","DefaultSettings.Flags",0x00010001,0
-HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\nv4\Device0","DefaultSettings.XPanning",0x00010001,0
-HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\nv4\Device0","DefaultSettings.YPanning",0x00010001,0
-</PRE>
-Feel free to adjust the DefaultSettings.BitsPerPel, DefaultSettings.XResolution,
-DefaultSettings.YResolution and DefaultSettings.VRefresh (check the Display control
-panel applet in MS-Windows for available settings for your card/monitor combo).<BR>
-Search that same file for the "VGA miniport driver" section and change the "Start"
-line in that section to:
-<PRE>
-HKLM,"SYSTEM\CurrentControlSet\Services\Vga","Start",0x00010001,0x00000004
-</PRE>
-(i.e. set the last value on that line to 4).<BR>
-Rebuild the registry with the command "make registry" and copy the resulting SYSTEM file
-to /ReactOS/System32/config. Reboot and enjoy.
-
-</BODY>
-</HTML>
diff --git a/reactos/base/applications/utils/patchnv4/patchnv4.c b/reactos/base/applications/utils/patchnv4/patchnv4.c
deleted file mode 100644 (file)
index 52f7ab6..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/* $Id$
- *
- * Patch the NVidia miniport driver to work with ReactOS
- *
- * Should become obsolete
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-struct Patch
-{
-  long Offset;
-  unsigned char ExpectedValue;
-  unsigned char NewValue;
-};
-
-static struct Patch Patches[ ] =
-{
-  { 0x1EBA9, 0x30, 0x3C },
-  { 0x1EBAA, 0xC0, 0xF0 },
-  { 0x1EC0B, 0x04, 0x01 },
-  { 0x1EC67, 0x30, 0x3C },
-  { 0x1EC68, 0xC0, 0xF0 }
-};
-
-int
-main(int argc, char *argv[])
-{
-  static char OriginalName[] = "nv4_mini.sys";
-  static char TempName[] = "nv4_mini.tmp";
-  static char BackupName[] = "nv4_mini.sys.orig";
-  FILE *File;
-  unsigned char *Buffer;
-  long Size;
-  unsigned n;
-
-  /* Read the whole file in memory */
-  File = fopen(OriginalName, "rb");
-  if (NULL == File)
-    {
-      perror("Unable to open original file");
-      exit(1);
-    }
-  if (fseek(File, 0, SEEK_END))
-    {
-      perror("Unable to determine file length");
-      fclose(File);
-      exit(1);
-    }
-  Size = ftell(File);
-  if (-1 == Size)
-    {
-      perror("Unable to determine file length");
-      fclose(File);
-      exit(1);
-    }
-  Buffer = malloc(Size);
-  if (NULL == Buffer)
-    {
-      perror("Can't allocate buffer");
-      fclose(File);
-      exit(1);
-    }
-  rewind(File);
-  if (Size != fread(Buffer, 1, Size, File))
-    {
-      perror("Error reading from original file");
-      free(Buffer);
-      fclose(File);
-      exit(1);
-    }
-  fclose(File);
-
-  /* Patch the file */
-  for (n = 0; n < sizeof(Patches) / sizeof(struct Patch); n++)
-    {
-      if (Buffer[Patches[n].Offset] != Patches[n].ExpectedValue)
-        {
-          fprintf(stderr, "Expected value 0x%02x at offset 0x%lx but found 0x%02x\n",
-                  Patches[n].ExpectedValue, Patches[n].Offset,
-                  Buffer[Patches[n].Offset]);
-          free(Buffer);
-          exit(1);
-        }
-      Buffer[Patches[n].Offset] = Patches[n].NewValue;
-    }
-
-  /* Write the new file */
-  File = fopen(TempName, "wb");
-  if (NULL == File)
-    {
-      perror("Unable to open output file");
-      free(Buffer);
-      exit(1);
-    }
-  if (Size != fwrite(Buffer, 1, Size, File))
-    {
-      perror("Error writing to output file");
-      fclose(File);
-      remove(TempName);
-      free(Buffer);
-      exit(1);
-    }
-  fclose(File);
-  free(Buffer);
-
-  /* Rename the original file, removing an existing backup */
-  remove(BackupName);
-  if (0 != rename(OriginalName, BackupName))
-    {
-      perror("Failed to rename original file");
-      remove(TempName);
-      exit(1);
-    }
-
-  /* Rename the new file */
-  if (0 != rename(TempName, OriginalName))
-    {
-      perror("Failed to rename new file");
-      remove(TempName);
-      rename(BackupName, OriginalName);
-      exit(1);
-    }
-
-  return 0;
-}