Einzelnen Beitrag anzeigen

Assarbad
(Gast)

n/a Beiträge
 
#1

Geschützte Dateien (SFC) auflisten

  Alt 21. Aug 2003, 14:45
Hier ein kleines Programm um alle SFC-geschützten Dateien aufzulisten

Hier die Downloads:
http://assarbad.net/stuff/!export/getsfcfiles.ace
http://assarbad.net/stuff/!export/getsfcfiles.rar
http://assarbad.net/stuff/!export/getsfcfiles.zip

Da es Klagen gab, man wisse nicht, was SFC/WFP ist ... hier die Informationen zum Anklicken Bei Google suchenSFC WFP Windows 2000

... und ein kurzer Abriß
Winlogon.exe, also der Prozeß, der für die Verwaltung von Benutzeranmeldungen verantwortlich ist und von SMSS.exe (dem Sessionmanager) gestartet wird, lädt eine DLL SFC.DLL aus %SystemRoot%\System32\. Diese DLL implementiert verschiedene Schutz- und Prüfmechanismen um die Integrität der wichtigsten Systemdateien zu gewährleisten. Jeder hat es sicher schon einmal erlebt, daß er eine DLL oder andere Systemdatei aus dem System32-Verzeichnis gelöscht hat, und danach aufgefordert wurde sie wiederherzustellen. Das passiert, wenn die entsprechende Datei nicht als Sicherheitskopie in %SystemRoot%\System32\DllCache\ vorliegt. So wird man dann aufgefordert die Installations-CD einzulegen. SFC steht übrigens für System File Ceck(er). WFP für Windows File Protection. Beim Start von Windows wird also beim Start der GUI entsprechend diverser Einstellungen in der Registry ein Integritätscheck vorgenommen. Deshalb sind Änderungen, die man in der Rettungskonsole gemacht hat manchmal plötzlich weg ...

Mein kleines Proggy listet nun alle geschützten Dateien auf und sollte auch auf XP funktionieren.

Delphi-Quellcode:
(******************************************************************************
******************************************************************************
***                                                                        ***
***  Sample code for use of undocumented GetSfcFiles API from sfcfiles.dll ***
***  Version [1.00]                              {Last mod 2003-08-21}  ***
***                                                                        ***
******************************************************************************
******************************************************************************

                                _\\|//_
                                (` * * ')
______________________________ooO_(_)_Ooo_____________________________________
******************************************************************************
******************************************************************************
***                                                                        ***
***                Copyright (c) 1995 - 2003 by -=Assarbad=-              ***
***                                                                        ***
***            ___                                                        ***
***            /  |                    ||              ||                ***
***          / _  |  ________ ___  ____||__    ___  __||                ***
***          / /_\ |  / __/ __//  |/  _/|  \  /  | /  |                ***
***        / ___  |__\\__\\  / /\ || |  | /\ \/ /\ |/ /\ | DOT NET        ***
***        /_/  \_/___/___/ /_____\|_|  |____/_____\\__/\|                ***
***      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~        ***
***              [[url]http://assarbad.net[/url] | [url]http://assarbad.org][/url]              ***
***                                                                        ***
***  Notes:                                                              ***
***  - my first name is Oliver, you may well use this in your e-mails    ***
***  - for questions and/or proposals drop me a mail or instant message  ***
***                                                                        ***
***~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~***
***              May the source be with you, stranger ... ;)              ***
***    Snizhok, eto ne tolko fruktovij kefir, snizhok, eto stil zhizn.    ***
***                    Vsem Privet iz Germanij                            ***
***                                                                        ***
*** Greets from -=Assarbad=- fly to YOU =)                                ***
*** Special greets fly 2 Nico, Casper, SA, Pizza, Navarion, Eugen, Zhenja, ***
*** Xandros, Melkij, Strelok etc pp.                                      ***
***                                                                        ***
*** Thanks to:                                                            ***
*** W.A. Mozart, Vivaldi, Beethoven, Poeta Magica, Kurtzweyl, Manowar,    ***
*** Blind Guardian, Weltenbrand, In Extremo, Wolfsheim, Carl Orff, Zemfira ***
*** ... most of my work was done with their music in the background ;)    ***
***                                                                        ***
******************************************************************************
******************************************************************************

LEGAL STUFF:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copyright (c) 1995-2003, -=Assarbad=- ["copyright holder(s)"]
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
    list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.
3. The name(s) of the copyright holder(s) may not be used to endorse or
    promote products derived from this software without specific prior written
    permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            .oooO    Oooo.
____________________________(  )_____(  )___________________________________
                              \ (      ) /
                              \_)    (_/

******************************************************************************)


program GetSfcFiles_Sample;
{$APPTYPE CONSOLE}
uses
  Windows;


type
  TSfcList = record
    wcsFileNameInDllCache: PWideChar; // Name of the file in DllCache
    wcsFilePath: PWideChar; // Path of the protected file
    wcsWhatEverInfFile: PWideChar; // Name of some INF file ... unknown meaning
  end;
  TSfcListArray = array[0..0] of TSfcList;
  PSfcListArray = ^TSfcListArray;

function SfcGetFiles(
  var lpNamelist: PSfcListArray;
  var lpNumEntries: DWORD
  ): DWORD; stdcall; external 'sfcfiles.dll';
(* Call and then iterate through the array with wide strings NumEntries times. *)

var
  namelist:PSfcListArray;
  i, num:DWORD;
begin
{ This crappy example simply dumps all SFC protected files to the console }
  if SfcGetFiles(namelist, num)=ERROR_SUCCESS then
    for i:=0 to num-1 do
      Writeln(String(namelist^[i].wcsFilePath));
end.
[edit=Daniel B]Titel korrigiert. Mfg, Daniel B[/edit]
[edit=CalganX]Titel geändert, Klassizifierung korrigiert, Cache erneuert. Mfg, CalganX[/edit]
  Mit Zitat antworten Zitat