INIDateien und Registry Arbeiten mit der Registry von
INI-Dateien und Registry Arbeiten mit der Registry von Windows NT / Windows 95 in Microsoft Visual Fox. Pro Wizards & Builders Gmb. H
Diese Schulung dient der Einführung in das Arbeiten mit INI-Dateien sowie der Registry von Windows NT unter Microsoft Visual Fox. Pro Wizards & Builders Gmb. H
Themenübersicht Ø Aufbau von INI-Dateien Ø Verarbeiten von INI-Dateien Ø Bearbeiten der Registry Ø Bereiche der Registry Ø Die Bereiche im Einzelnen Ø Werttypen in der Registry Ø Dateien der Registry Ø Beispiele für Registry-Keys Ø VFP-Funktionen für Registry Ø Betriebssystem-Funktionen für Registry Wizards & Builders Gmb. H
Arbeiten mit INI-Dateien Verwendung von INI-Dateien unter Microsoft Visual Fox. Pro Wizards & Builders Gmb. H
Aufbau von INI-Dateien Werden nur noch ungern verwendet l Können an beliebiger Stelle sein l Enthalten versch. [Bereiche] l Darunter einen Schlüssel mit einer Wertzuweisung l Wizards & Builders Gmb. H
Verarbeiten von INI-Dateien l Deklaration DLL in WIN 32 API: DECLARE INTEGER Get. Private. Profile. String in win 32 api String, String @, integer, string DECLARE INTEGER Write. Private. Profile. String in win 32 api String, String @, integer, string l Aufruf der Funktion: =Get. Private. Profile. String( <tc. Section>, <tc. Var>, "", @<tc. Buffer>, len(<tcbuffer>), <tc. Ini. File>) *-- Rückgabe der gültigen neuen Bufferlänge tc. Buffer = left( tc. Buffer, ln. Len ) Wizards & Builders Gmb. H
Registry Struktur der Registry unter Microsoft Windows NT Wizards & Builders Gmb. H
Bearbeiten der Registry l REGEDIT. EXE Ø Übersichtliche Darstellung unter NT l REGEDT 32. EXE Ø Darstellung in getrennten Fenstern Ø Speichern von Bereichen der Registry l Systemfunktionen Ø Direktes Lesen/Schreiben von Einträgen Wizards & Builders Gmb. H
Aufbau der Registry Wizards & Builders Gmb. H
Aufbau und Sinn der Registry Hierarchische Gliederung von Konfigurationsinformationen l Einheitlicher Zugriff über „Schlüssel“ (Hierarchie) l Definition von „Name“, „Datentyp“ und „Wert“ l Zentrale Speicherung im OS l Wizards & Builders Gmb. H
Bereiche der Registry HKEY_LOCAL_MACHINE l HKEY_USERS l HKEY_DYN_DATA l HKEY_CLASSES_ROOT l HKEY_CURRENT_USER l HKEY_CURRENT_CONFIG l Wizards & Builders Gmb. H
Verkürzte Einträge l HKEY_CLASSES_ROOT Ø entspricht HKEY_LOCAL_MACHINE SoftwareClasses l HKEY_CURRENT_USER Ø entspricht HKEY_USERS für den aktuellen Anwender l HKEY_CURRENT_CONFIG Ø entspricht HKEY_LOCAL_MACHINE Software bzw. Hardware für aktuelle Konfiguration Wizards & Builders Gmb. H
Tatsächliche Einträge l HKEY_LOCAL_MACHINE Ø Komplette Konfiguration für den Arbeitsplatz ohne Benutzerspezifisches l HKEY_USERS Ø Anwenderspezifische Daten l HKEY_DYN_DATA Ø Dynamische Daten - kein Bearbeiten oder Lesen möglich! Wizards & Builders Gmb. H
HKEY_LOCAL_MACHINE (1) l HARDWARE Ø wird beim Systemstart neu aufgebaut Ø siehe separate Aufstellung l SAM Ø Security Account Manager Ø Zugriff nur über Benutzermanager l SECURITY Ø ebenfalls kein direkter Zugriff Wizards & Builders Gmb. H
HKEY_LOCAL_MACHINE (2) l SOFTWARE Ø Diverse Schlüssel von Microsoft Ø Schlüssel anderer Hersteller (!) Ø siehe separate Aufstellung l SYSTEM Ø Konfiguration Einheitentreiber Ø Konfiguration Dienste von NT Ø siehe separate Aufstellung Wizards & Builders Gmb. H
HKEY_LOCAL_MACHINEHARDWARE l DESCRIPTION Ø Beim Start gesammelte Systeminformationen - änderbar aber bei nächstem Start überschrieben. . . l DEVICEMAP Ø Verweis auf Registry-Informationen l RESOURCEMAP Ø Zuordnung Treiber zu IRQ/IO usw. Wizards & Builders Gmb. H
HKEY_LOCAL_MACHINESOFTWARE CLASSES = HKEY_CLASSES_ROOT l MICROSOFT = Programme/System l PROGRAM GROUPS (alt) l SECURE = Administratoren l WIN 3. 1 MIGRATION STATUS l Ø Windows 3. 1. Migration Status INI-Files Wizards & Builders Gmb. H
Hinweis HKEY_CLASSES_ROOT Erstmal alle System-Endungen l Bei den meisten Einträgen Untereintrag mit Verweis CLSID l CLSID mit Untereintrag mit Verweis auf TYPELIB l TYPLIB enthält Interface-Beschreibung (OLE 2 -Viewer) l Wizards & Builders Gmb. H
HKEY_LOCAL_MACHINESYSTEM l CLONE Ø Letzte lauffähige Version l CONTROLSETnnn Ø verschiedene Control-Sets l CURRENTCONTROLSET Ø aktuelle Konfiguration l SELECT Ø Current, Default, Failed, Last. Known. Good l SETUP Wizards & Builders Gmb. H
HKEY_LOCAL_MACHINESYSTEMControlset l CONTROL Ø Einstellungen für Systemstart l SERVICES Ø Einheitentreiber und Dienste Ø Diverse Treiber für nicht vorhandenes. . . HARDWARE PROFILES (ggf. ) l ENUM (Plug & Play) (ggf. ) l Wizards & Builders Gmb. H
Datentypen in der Registry REG_BINARY Binär/Hexawert l REG_DWORD 32 -Bit-Wert Hex l REG_SZ Zeichenkette l REG_EXPAND_SZ Expandiert l Ø z. B. für Verwendung von Platzhaltern Ø Beispiel: %systemroot% l REG_MULTI_SZ Mehrzeilig Wizards & Builders Gmb. H
Dateien der Registry l %systemroot%PROFILES Ø Defaultuser mit NTUSER. DAT-Vorlage Ø <User>-Verzeichnis mit NTUSER. DAT l %systemroot%SYSTEM 32CONFIG Ø HKEY_LOCAL_MACHINE Ø Default, SAM, Security, Software, System Ø *. = Original, *. ALT = Backup, *. LOG = Protokoll, *. SAV = Zusatzinformationen Wizards & Builders Gmb. H
Beispiele Registry-Schlüssel l Einstellung Sommerzeit: · "HKEY_LOCAL_MACHINESystemCurrent. Control. SetContr olTime. Zone. Information" anwählen · Bei der Position "Standard. Start" im dritten Zahlenpaar die 09 durch 0 A ersetzen l Einstellung Source-Control: · "HKEY_LOCAL_MACHINESOFTWARESource. Control. Provi derInstalled. SCCProvider“ l Einstellungen zu Visual Fox. Pro Wizards & Builders Gmb. H
Programmierung Registry Programmierung der Registry mit Microsoft Visual Fox. Pro Wizards & Builders Gmb. H
Registry-Funktionen in VFP =SYS(3056, 1) l SET OLEOBJECT ON/OFF l -R-Switch l Registry-Objekt l Ø Get. App. Path Ø Get. Latest. Version Ø Get. Application Wizards & Builders Gmb. H
Programmierung (1) l WINAPI-Funktionsdeklarationen: DECLARE INTEGER Reg. Open. Key IN Win 32 API ; INTEGER h. Key, ; && handle of open key STRING @lpsz. Sub. Key, ; && address of name of subkey to open INTEGER @phk. Result && address of handle of open key DECLARE INTEGER Reg. Create. Key IN Win 32 API ; INTEGER h. Key, ; && handle of open key STRING @lpsz. Sub. Key, ; && address of name of subkey && to create INTEGER @phk. Result && address of handle of open key DECLARE INTEGER Reg. Close. Key IN Win 32 API ; INTEGER h. Key && handle of open key DECLARE INTEGER Reg. Delete. Key IN Win 32 API ; INTEGER h. Key, ; && handle of open key STRING @lpsz. Sub. Key && address of name of &&subkey to delete Wizards & Builders Gmb. H
Programmierung (2) DECLARE INTEGER Reg. Delete. Value IN Win 32 API ; INTEGER n. HKey, ; && handle of key STRING c. Sub. Key && address of value name DECLARE INTEGER Reg. Set. Value. Ex IN Win 32 API ; INTEGER h. Key, ; && handle of key to set value for STRING lp. Value. Name, ; && address of value to set INTEGER Reserved, ; && reserved, set to 0 INTEGER dw. Type, ; && flag for value type STRING lp. Data, ; && address of value data INTEGER cb. Data && size of value data DECLARE INTEGER Reg. Query. Value. Ex IN Win 32 API ; INTEGER h. Key, ; && handle of key to query STRING lpsz. Value. Name, ; && address of name of value to query INTEGER lpdw. Reserved, ; && reserved INTEGER @lpdw. Type, ; && address of buffer for value type STRING @lpb. Data, ; && address of data buffer INTEGER @lpcb. Data && address of data buffer size Wizards & Builders Gmb. H
Beispiel Solution-Samples * Die Library ist im Solution Sample enthalten set library to progsreg_sol lc. Program= "" lc. Pfad= "" o. Reg= create( "File. Reg") * Get. Application( c. Extn. Key, c. App. Key, l. Server) * Get. App. Path( c. Extension, c. Extn. Key, c. App. Key, l. Server) if o. Reg. Get. App. Path( "DOC", @lc. Program, @lc. Pfad) # 0 return endif ? lc. Program ? lc. Pfad Wizards & Builders Gmb. H
Konstanten für Registry #define #define #define HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY_LOCAL_MACHINE REG_SZ REG_OPTION_RESERVED REG_CLASS_DEFAULT REG_SECURITY_DEFAULT REG_OPTION_NON_VOLATILE REG_OPTION_VOLATILE REG_ALL_ACCESS -2147483648 -2147483647 -2147483646 1 0 "" 0 0 1 63 Wizards & Builders Gmb. H
Welche Fragen stellen sich? l l l Verwendung der Registry eigentlich zwingend (!) Anlegen / Lesen von lokalen Registry. Werten Hierarchie (!) Wizards & Builders Gmb. H
Vielen Dank! Das waren die Themen: Ø Aufbau von INI-Dateien Ø Verarbeiten von INI-Dateien Ø Bearbeiten der Registry Ø Bereiche der Registry Ø Die Bereiche im Einzelnen Ø Werttypen in der Registry Ø Dateien der Registry Ø Beispiele für Registry-Keys Ø VFP-Funktionen für Registry Ø Betriebssystem-Funktionen für Registry Wizards & Builders Gmb. H
Wenn Fragen bestehen: Wizards & Builders Methodische Software. Entwicklung Gmb. H Frankfurter Str. 21 b 61476 Kronberg Tel. : 06173 -950906 Fax: 06173 -950907 CIS: 101605, 175 Wizards & Builders Gmb. H
- Slides: 32