|
// RegSR.h : main header file for the REGSR application
// Author: A.YEZZA
// Date: August 2004
// Subject: Save/Restore registry keys in very safe mode
// Comment: Use with your own risk
// Licence: This code and application are free. The only
// condition is preserving author name
///////////////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_REGSR_H__C1C474B1_CABA_44B7_961B_DD6E97FCD3B9__INCLUDED_)
#define AFX_REGSR_H__C1C474B1_CABA_44B7_961B_DD6E97FCD3B9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
//////////////
// Constants
//////////////
// Registry hives strings
#define HKCU "HKCU"
#define HKLM "HKLM"
#define HKUSERS "HKUSERS"
#define HKCURCFG "HKCURCFG"
// Config file sections
#define SEC_SETTINGS "SETTINGS"
#define SEC_KEYS_FILES "KEYS_FILES"
#define SEC_CRC32 "CRC32"
#define DATA_SERVER_PATH "ServerPath" //location where we (save to)/(retore from) registry data files
#define DATA_CONFIG_FILE "ConfigFile" //Config file name should be saved in DATA_SERVER_PATH
////////////////////////////////////////////////////////////////////////////////////////////////////
#include "resource.h" // main symbols
struct CmdParams{
CString Op;
CString Root;
CString KeyPath;
CString InOutFile;
CString ConfigFile;
};
struct FileCRC32{
CString FileName; //File name with its path
CString CRC32; //File CRC32
CString hHive; //Handle to the hive of the key corresponding to the saved file
CString KeyPath; //Key path without its hive
CString ServerPath; //location where we (save to)/(retore from) registry data files
CString ConfigFile; //Config file name should be saved in ServerPath
};
/////////////////////////////////////////////////////////////////////////////
// CRegSRApp:
// See RegSR.cpp for the implementation of this class
//
class CRegSRApp : public CWinApp
{
private:
CmdParams Params;
CString ServerPath; //server path where config file is saved
CString ConfigFile; //Cofig file containing correspondance between keys/data files
//and CRC files
FileCRC32 SavResFile;
public:
CRegSRApp();
void SetParams(CmdParams &Params, int &ParamsNum);
void DoSaveRestore(DWORD &RetErr);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRegSRApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CRegSRApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void GetParams(CString& CmdLine, int &ParamsNum);
void SetSavResFile();
HKEY GetHiveFromString(LPCSTR strHive);
BOOL IsFileExist(LPCSTR FilePath);
BOOL IsKeyExist(HKEY hRoot, LPCSTR KeyPath);
BOOL SetPrivilege(LPCTSTR lpszPrivilege, BOOL bEnablePrivilege);
//void Set_FileName(CString &Root, CString &SubKey);
BOOL Get_CRC32();
//void Get_hHive(CString &str);
//void Get_KeyPath(CString &str);
void Usage();
void GetSettings();
BOOL CheckIntegrity(CString &Root, CString &SubKey, CString &InFile);
BOOL RestoreRegKeyPath(CString &Root, CString &SubKey, CString &InFile, DWORD &RetError);
BOOL SaveRegKeyPath(CString &Root, CString &SubKey, CString &OutFile, DWORD &RetError);
CString AddBackSlash(CString &strPath);
CString GetFileDirectory(CString &FilePathName);
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_REGSR_H__C1C474B1_CABA_44B7_961B_DD6E97FCD3B9__INCLUDED_)
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.