mirror of
https://github.com/reactos/reactos.git
synced 2024-06-28 17:01:28 +00:00
[REGEDIT]
- Katayama Hirofumi: Unicodify regedit, add support for import/export of v5 reg files. Based on Wine regedit. svn path=/trunk/; revision=48933
This commit is contained in:
parent
219137196e
commit
26adfda6bd
|
@ -227,8 +227,8 @@ static void SuggestKeys(HKEY hRootKey, LPCTSTR pszKeyPath, LPTSTR pszSuggestions
|
||||||
bFound = FALSE;
|
bFound = FALSE;
|
||||||
|
|
||||||
/* Check default key */
|
/* Check default key */
|
||||||
if (RegQueryStringValue(hRootKey, pszKeyPath, NULL,
|
if (QueryStringValue(hRootKey, pszKeyPath, NULL,
|
||||||
szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])) == ERROR_SUCCESS)
|
szBuffer, COUNT_OF(szBuffer)) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Sanity check this key; it cannot be empty, nor can it be a
|
/* Sanity check this key; it cannot be empty, nor can it be a
|
||||||
* loop back */
|
* loop back */
|
||||||
|
@ -259,8 +259,8 @@ static void SuggestKeys(HKEY hRootKey, LPCTSTR pszKeyPath, LPTSTR pszSuggestions
|
||||||
/* Check CLSID key */
|
/* Check CLSID key */
|
||||||
if (RegOpenKey(hRootKey, pszKeyPath, &hSubKey) == ERROR_SUCCESS)
|
if (RegOpenKey(hRootKey, pszKeyPath, &hSubKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (RegQueryStringValue(hSubKey, TEXT("CLSID"), NULL,
|
if (QueryStringValue(hSubKey, TEXT("CLSID"), NULL, szBuffer,
|
||||||
szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])) == ERROR_SUCCESS)
|
COUNT_OF(szBuffer)) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
lstrcpyn(pszSuggestions, TEXT("HKCR\\CLSID\\"), (int) iSuggestionsLength);
|
lstrcpyn(pszSuggestions, TEXT("HKCR\\CLSID\\"), (int) iSuggestionsLength);
|
||||||
i = _tcslen(pszSuggestions);
|
i = _tcslen(pszSuggestions);
|
||||||
|
@ -535,8 +535,8 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (RegRenameKey(hRootKey, keyPath, ptvdi->item.pszText) != ERROR_SUCCESS)
|
if (RenameKey(hRootKey, keyPath, ptvdi->item.pszText) != ERROR_SUCCESS)
|
||||||
lResult = FALSE;
|
lResult = FALSE;
|
||||||
}
|
}
|
||||||
return lResult;
|
return lResult;
|
||||||
}
|
}
|
||||||
|
|
|
@ -702,6 +702,91 @@ done:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LONG CopyKey(HKEY hDestKey, LPCTSTR lpDestSubKey, HKEY hSrcKey, LPCTSTR lpSrcSubKey)
|
||||||
|
{
|
||||||
|
LONG lResult;
|
||||||
|
DWORD dwDisposition;
|
||||||
|
HKEY hDestSubKey = NULL;
|
||||||
|
HKEY hSrcSubKey = NULL;
|
||||||
|
DWORD dwIndex, dwType, cbName, cbData;
|
||||||
|
TCHAR szSubKey[256];
|
||||||
|
TCHAR szValueName[256];
|
||||||
|
BYTE szValueData[512];
|
||||||
|
|
||||||
|
FILETIME ft;
|
||||||
|
|
||||||
|
/* open the source subkey, if specified */
|
||||||
|
if (lpSrcSubKey)
|
||||||
|
{
|
||||||
|
lResult = RegOpenKeyEx(hSrcKey, lpSrcSubKey, 0, KEY_ALL_ACCESS, &hSrcSubKey);
|
||||||
|
if (lResult)
|
||||||
|
goto done;
|
||||||
|
hSrcKey = hSrcSubKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* create the destination subkey */
|
||||||
|
lResult = RegCreateKeyEx(hDestKey, lpDestSubKey, 0, NULL, 0, KEY_WRITE, NULL,
|
||||||
|
&hDestSubKey, &dwDisposition);
|
||||||
|
if (lResult)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
/* copy all subkeys */
|
||||||
|
dwIndex = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
cbName = sizeof(szSubKey) / sizeof(szSubKey[0]);
|
||||||
|
lResult = RegEnumKeyEx(hSrcKey, dwIndex++, szSubKey, &cbName, NULL, NULL, NULL, &ft);
|
||||||
|
if (lResult == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
lResult = CopyKey(hDestSubKey, szSubKey, hSrcKey, szSubKey);
|
||||||
|
if (lResult)
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while(lResult == ERROR_SUCCESS);
|
||||||
|
|
||||||
|
/* copy all subvalues */
|
||||||
|
dwIndex = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
cbName = sizeof(szValueName) / sizeof(szValueName[0]);
|
||||||
|
cbData = sizeof(szValueData) / sizeof(szValueData[0]);
|
||||||
|
lResult = RegEnumValue(hSrcKey, dwIndex++, szValueName, &cbName, NULL, &dwType, szValueData, &cbData);
|
||||||
|
if (lResult == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
lResult = RegSetValueEx(hDestSubKey, szValueName, 0, dwType, szValueData, cbData);
|
||||||
|
if (lResult)
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while(lResult == ERROR_SUCCESS);
|
||||||
|
|
||||||
|
lResult = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (hSrcSubKey)
|
||||||
|
RegCloseKey(hSrcSubKey);
|
||||||
|
if (hDestSubKey)
|
||||||
|
RegCloseKey(hDestSubKey);
|
||||||
|
if (lResult != ERROR_SUCCESS)
|
||||||
|
SHDeleteKey(hDestKey, lpDestSubKey);
|
||||||
|
return lResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LONG MoveKey(HKEY hDestKey, LPCTSTR lpDestSubKey, HKEY hSrcKey, LPCTSTR lpSrcSubKey)
|
||||||
|
{
|
||||||
|
LONG lResult;
|
||||||
|
|
||||||
|
if (!lpSrcSubKey)
|
||||||
|
return ERROR_INVALID_FUNCTION;
|
||||||
|
|
||||||
|
lResult = CopyKey(hDestKey, lpDestSubKey, hSrcKey, lpSrcSubKey);
|
||||||
|
if (lResult == ERROR_SUCCESS)
|
||||||
|
SHDeleteKey(hSrcKey, lpSrcSubKey);
|
||||||
|
|
||||||
|
return lResult;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath)
|
BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath)
|
||||||
{
|
{
|
||||||
TCHAR msg[128], caption[128];
|
TCHAR msg[128], caption[128];
|
||||||
|
@ -732,3 +817,128 @@ done:
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LONG RenameKey(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpNewName)
|
||||||
|
{
|
||||||
|
LPCTSTR s;
|
||||||
|
LPTSTR lpNewSubKey = NULL;
|
||||||
|
LONG Ret = 0;
|
||||||
|
|
||||||
|
if (!lpSubKey)
|
||||||
|
return Ret;
|
||||||
|
|
||||||
|
s = _tcsrchr(lpSubKey, _T('\\'));
|
||||||
|
if (s)
|
||||||
|
{
|
||||||
|
s++;
|
||||||
|
lpNewSubKey = (LPTSTR) HeapAlloc(GetProcessHeap(), 0, (s - lpSubKey + _tcslen(lpNewName) + 1) * sizeof(TCHAR));
|
||||||
|
if (lpNewSubKey != NULL)
|
||||||
|
{
|
||||||
|
memcpy(lpNewSubKey, lpSubKey, (s - lpSubKey) * sizeof(TCHAR));
|
||||||
|
lstrcpy(lpNewSubKey + (s - lpSubKey), lpNewName);
|
||||||
|
lpNewName = lpNewSubKey;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ret = MoveKey(hKey, lpNewName, hKey, lpSubKey);
|
||||||
|
|
||||||
|
if (lpNewSubKey)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpNewSubKey);
|
||||||
|
}
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG RenameValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpDestValue, LPCTSTR lpSrcValue)
|
||||||
|
{
|
||||||
|
LONG lResult;
|
||||||
|
HKEY hSubKey = NULL;
|
||||||
|
DWORD dwType, cbData;
|
||||||
|
BYTE data[512];
|
||||||
|
|
||||||
|
if (lpSubKey)
|
||||||
|
{
|
||||||
|
lResult = RegOpenKey(hKey, lpSubKey, &hSubKey);
|
||||||
|
if (lResult != ERROR_SUCCESS)
|
||||||
|
goto done;
|
||||||
|
hKey = hSubKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbData = sizeof(data);
|
||||||
|
lResult = RegQueryValueEx(hKey, lpSrcValue, NULL, &dwType, data, &cbData);
|
||||||
|
if (lResult != ERROR_SUCCESS)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
lResult = RegSetValueEx(hKey, lpDestValue, 0, dwType, data, cbData);
|
||||||
|
if (lResult != ERROR_SUCCESS)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
RegDeleteValue(hKey, lpSrcValue);
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (hSubKey)
|
||||||
|
RegCloseKey(hSubKey);
|
||||||
|
return lResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG QueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTSTR pszBuffer, DWORD dwBufferLen)
|
||||||
|
{
|
||||||
|
LONG lResult;
|
||||||
|
HKEY hSubKey = NULL;
|
||||||
|
DWORD cbData, dwType;
|
||||||
|
|
||||||
|
if (lpSubKey)
|
||||||
|
{
|
||||||
|
lResult = RegOpenKey(hKey, lpSubKey, &hSubKey);
|
||||||
|
if (lResult != ERROR_SUCCESS)
|
||||||
|
goto done;
|
||||||
|
hKey = hSubKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbData = (dwBufferLen - 1) * sizeof(*pszBuffer);
|
||||||
|
lResult = RegQueryValueEx(hKey, lpValueName, NULL, &dwType, (LPBYTE) pszBuffer, &cbData);
|
||||||
|
if (lResult != ERROR_SUCCESS)
|
||||||
|
goto done;
|
||||||
|
if (dwType != REG_SZ)
|
||||||
|
{
|
||||||
|
lResult = -1;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
pszBuffer[cbData / sizeof(*pszBuffer)] = _T('\0');
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (lResult != ERROR_SUCCESS)
|
||||||
|
pszBuffer[0] = _T('\0');
|
||||||
|
if (hSubKey)
|
||||||
|
RegCloseKey(hSubKey);
|
||||||
|
return lResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL GetKeyName(LPTSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCTSTR lpSubKey)
|
||||||
|
{
|
||||||
|
LPCTSTR pszRootKey;
|
||||||
|
|
||||||
|
if (hRootKey == HKEY_CLASSES_ROOT)
|
||||||
|
pszRootKey = TEXT("HKEY_CLASSES_ROOT");
|
||||||
|
else if (hRootKey == HKEY_CURRENT_USER)
|
||||||
|
pszRootKey = TEXT("HKEY_CURRENT_USER");
|
||||||
|
else if (hRootKey == HKEY_LOCAL_MACHINE)
|
||||||
|
pszRootKey = TEXT("HKEY_LOCAL_MACHINE");
|
||||||
|
else if (hRootKey == HKEY_USERS)
|
||||||
|
pszRootKey = TEXT("HKEY_USERS");
|
||||||
|
else if (hRootKey == HKEY_CURRENT_CONFIG)
|
||||||
|
pszRootKey = TEXT("HKEY_CURRENT_CONFIG");
|
||||||
|
else if (hRootKey == HKEY_DYN_DATA)
|
||||||
|
pszRootKey = TEXT("HKEY_DYN_DATA");
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (lpSubKey[0])
|
||||||
|
_sntprintf(pszDest, iDestLength, TEXT("%s\\%s"), pszRootKey, lpSubKey);
|
||||||
|
else
|
||||||
|
_sntprintf(pszDest, iDestLength, TEXT("%s"), pszRootKey);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -19,6 +19,12 @@
|
||||||
|
|
||||||
#include <regedit.h>
|
#include <regedit.h>
|
||||||
|
|
||||||
|
#define RSF_WHOLESTRING 0x00000001
|
||||||
|
#define RSF_LOOKATKEYS 0x00000002
|
||||||
|
#define RSF_LOOKATVALUES 0x00000004
|
||||||
|
#define RSF_LOOKATDATA 0x00000008
|
||||||
|
#define RSF_MATCHCASE 0x00010000
|
||||||
|
|
||||||
static TCHAR s_szFindWhat[256];
|
static TCHAR s_szFindWhat[256];
|
||||||
static const TCHAR s_szFindFlags[] = _T("FindFlags");
|
static const TCHAR s_szFindFlags[] = _T("FindFlags");
|
||||||
static const TCHAR s_szFindFlagsR[] = _T("FindFlagsReactOS");
|
static const TCHAR s_szFindFlagsR[] = _T("FindFlagsReactOS");
|
||||||
|
@ -677,7 +683,7 @@ BOOL FindNext(HWND hWnd)
|
||||||
|
|
||||||
if (fSuccess)
|
if (fSuccess)
|
||||||
{
|
{
|
||||||
RegKeyGetName(szFullKey, COUNT_OF(szFullKey), hKeyRoot, pszFoundSubKey);
|
GetKeyName(szFullKey, COUNT_OF(szFullKey), hKeyRoot, pszFoundSubKey);
|
||||||
SelectNode(g_pChildWnd->hTreeWnd, szFullKey);
|
SelectNode(g_pChildWnd->hTreeWnd, szFullKey);
|
||||||
SetValueName(g_pChildWnd->hListWnd, pszFoundValueName);
|
SetValueName(g_pChildWnd->hListWnd, pszFoundValueName);
|
||||||
free(pszFoundSubKey);
|
free(pszFoundSubKey);
|
||||||
|
|
|
@ -278,6 +278,7 @@ static BOOL InitOpenFileName(HWND hWnd, OPENFILENAME* pofn)
|
||||||
pofn->lpstrFileTitle = FileTitleBuffer;
|
pofn->lpstrFileTitle = FileTitleBuffer;
|
||||||
pofn->nMaxFileTitle = _MAX_PATH;
|
pofn->nMaxFileTitle = _MAX_PATH;
|
||||||
pofn->Flags = OFN_HIDEREADONLY;
|
pofn->Flags = OFN_HIDEREADONLY;
|
||||||
|
pofn->lpstrDefExt = TEXT("reg");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,38 +286,33 @@ static BOOL ImportRegistryFile(HWND hWnd)
|
||||||
{
|
{
|
||||||
OPENFILENAME ofn;
|
OPENFILENAME ofn;
|
||||||
TCHAR Caption[128];
|
TCHAR Caption[128];
|
||||||
|
LPCTSTR pszKeyPath;
|
||||||
|
HKEY hRootKey;
|
||||||
|
|
||||||
InitOpenFileName(hWnd, &ofn);
|
InitOpenFileName(hWnd, &ofn);
|
||||||
LoadString(hInst, IDS_IMPORT_REG_FILE, Caption, sizeof(Caption)/sizeof(TCHAR));
|
LoadString(hInst, IDS_IMPORT_REG_FILE, Caption, COUNT_OF(Caption));
|
||||||
ofn.lpstrTitle = Caption;
|
ofn.lpstrTitle = Caption;
|
||||||
|
ofn.Flags |= OFN_ENABLESIZING;
|
||||||
/* ofn.lCustData = ;*/
|
/* ofn.lCustData = ;*/
|
||||||
if (GetOpenFileName(&ofn)) {
|
if (GetOpenFileName(&ofn)) {
|
||||||
/* FIXME - convert to ascii */
|
FILE *fp = _wfopen(ofn.lpstrFile, L"r");
|
||||||
if (!import_registry_file(ofn.lpstrFile)) {
|
if (fp == NULL || !import_registry_file(fp)) {
|
||||||
/*printf("Can't open file \"%s\"\n", ofn.lpstrFile);*/
|
LPSTR p = GetMultiByteString(ofn.lpstrFile);
|
||||||
|
fprintf(stderr, "Can't open file \"%s\"\n", p);
|
||||||
|
HeapFree(GetProcessHeap(), 0, p);
|
||||||
|
if (fp != NULL)
|
||||||
|
fclose(fp);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#if 0
|
fclose(fp);
|
||||||
get_file_name(&s, filename, MAX_PATH);
|
|
||||||
if (!filename[0]) {
|
|
||||||
printf("No file name is specified\n%s", usage);
|
|
||||||
return FALSE;
|
|
||||||
/*exit(1);*/
|
|
||||||
}
|
|
||||||
while (filename[0]) {
|
|
||||||
if (!import_registry_file(filename)) {
|
|
||||||
perror("");
|
|
||||||
printf("Can't open file \"%s\"\n", filename);
|
|
||||||
return FALSE;
|
|
||||||
/*exit(1);*/
|
|
||||||
}
|
|
||||||
get_file_name(&s, filename, MAX_PATH);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
CheckCommDlgError(hWnd);
|
CheckCommDlgError(hWnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RefreshTreeView(g_pChildWnd->hTreeWnd);
|
||||||
|
pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey);
|
||||||
|
RefreshListView(g_pChildWnd->hListWnd, hRootKey, pszKeyPath);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,8 +380,7 @@ BOOL ExportRegistryFile(HWND hWnd)
|
||||||
|
|
||||||
/* Figure out which key path we are exporting */
|
/* Figure out which key path we are exporting */
|
||||||
pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
|
pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
|
||||||
RegKeyGetName(ExportKeyPath, sizeof(ExportKeyPath) / sizeof(ExportKeyPath[0]),
|
GetKeyName(ExportKeyPath, COUNT_OF(ExportKeyPath), hKeyRoot, pszKeyPath);
|
||||||
hKeyRoot, pszKeyPath);
|
|
||||||
|
|
||||||
InitOpenFileName(hWnd, &ofn);
|
InitOpenFileName(hWnd, &ofn);
|
||||||
LoadString(hInst, IDS_EXPORT_REG_FILE, Caption, sizeof(Caption)/sizeof(TCHAR));
|
LoadString(hInst, IDS_EXPORT_REG_FILE, Caption, sizeof(Caption)/sizeof(TCHAR));
|
||||||
|
@ -396,44 +391,24 @@ BOOL ExportRegistryFile(HWND hWnd)
|
||||||
{
|
{
|
||||||
ofn.lCustData = (LPARAM) ExportKeyPath;
|
ofn.lCustData = (LPARAM) ExportKeyPath;
|
||||||
}
|
}
|
||||||
ofn.Flags = OFN_ENABLETEMPLATE | OFN_EXPLORER | OFN_ENABLEHOOK;
|
ofn.Flags = OFN_ENABLETEMPLATE | OFN_EXPLORER | OFN_ENABLEHOOK | OFN_OVERWRITEPROMPT;
|
||||||
ofn.lpfnHook = ExportRegistryFile_OFNHookProc;
|
ofn.lpfnHook = ExportRegistryFile_OFNHookProc;
|
||||||
ofn.lpTemplateName = MAKEINTRESOURCE(IDD_EXPORTRANGE);
|
ofn.lpTemplateName = MAKEINTRESOURCE(IDD_EXPORTRANGE);
|
||||||
if (GetSaveFileName(&ofn)) {
|
if (GetSaveFileName(&ofn)) {
|
||||||
BOOL result;
|
BOOL result;
|
||||||
LPSTR pszExportKeyPath;
|
DWORD format;
|
||||||
#ifdef UNICODE
|
|
||||||
CHAR buffer[_MAX_PATH];
|
if (ofn.nFilterIndex == 1)
|
||||||
|
format = REG_FORMAT_5;
|
||||||
WideCharToMultiByte(CP_ACP, 0, ExportKeyPath, -1, buffer, sizeof(buffer), NULL, NULL);
|
else
|
||||||
pszExportKeyPath = buffer;
|
format = REG_FORMAT_4;
|
||||||
#else
|
result = export_registry_key(ofn.lpstrFile, ExportKeyPath, format);
|
||||||
pszExportKeyPath = ExportKeyPath;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
result = export_registry_key(ofn.lpstrFile, pszExportKeyPath);
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
/*printf("Can't open file \"%s\"\n", ofn.lpstrFile);*/
|
LPSTR p = GetMultiByteString(ofn.lpstrFile);
|
||||||
|
fprintf(stderr, "Can't open file \"%s\"\n", p);
|
||||||
|
HeapFree(GetProcessHeap(), 0, p);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
TCHAR filename[MAX_PATH];
|
|
||||||
filename[0] = '\0';
|
|
||||||
get_file_name(&s, filename, MAX_PATH);
|
|
||||||
if (!filename[0]) {
|
|
||||||
printf("No file name is specified\n%s", usage);
|
|
||||||
return FALSE;
|
|
||||||
/*exit(1);*/
|
|
||||||
}
|
|
||||||
if (s[0]) {
|
|
||||||
TCHAR reg_key_name[KEY_MAX_LEN];
|
|
||||||
get_file_name(&s, reg_key_name, KEY_MAX_LEN);
|
|
||||||
export_registry_key((CHAR)filename, reg_key_name);
|
|
||||||
} else {
|
|
||||||
export_registry_key(filename, NULL);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
CheckCommDlgError(hWnd);
|
CheckCommDlgError(hWnd);
|
||||||
}
|
}
|
||||||
|
@ -543,7 +518,7 @@ BOOL CopyKeyName(HWND hWnd, HKEY hRootKey, LPCTSTR keyName)
|
||||||
if (!EmptyClipboard())
|
if (!EmptyClipboard())
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (!RegKeyGetName(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]), hRootKey, keyName))
|
if (!GetKeyName(szBuffer, COUNT_OF(szBuffer), hRootKey, keyName))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
hGlobal = GlobalAlloc(GMEM_MOVEABLE, (_tcslen(szBuffer) + 1) * sizeof(TCHAR));
|
hGlobal = GlobalAlloc(GMEM_MOVEABLE, (_tcslen(szBuffer) + 1) * sizeof(TCHAR));
|
||||||
|
|
|
@ -455,7 +455,7 @@ BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
|
||||||
LONG lResult;
|
LONG lResult;
|
||||||
|
|
||||||
keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
|
keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
|
||||||
lResult = RegRenameValue(hKeyRoot, keyPath, Info->item.pszText, lineinfo->name);
|
lResult = RenameValue(hKeyRoot, keyPath, Info->item.pszText, lineinfo->name);
|
||||||
lineinfo->name = realloc(lineinfo->name, (_tcslen(Info->item.pszText)+1)*sizeof(TCHAR));
|
lineinfo->name = realloc(lineinfo->name, (_tcslen(Info->item.pszText)+1)*sizeof(TCHAR));
|
||||||
if (lineinfo->name != NULL)
|
if (lineinfo->name != NULL)
|
||||||
_tcscpy(lineinfo->name, Info->item.pszText);
|
_tcscpy(lineinfo->name, Info->item.pszText);
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <regedit.h>
|
#include <regedit.h>
|
||||||
|
|
||||||
BOOL ProcessCmdLine(LPSTR lpCmdLine);
|
BOOL ProcessCmdLine(LPWSTR lpCmdLine);
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -143,9 +143,8 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore position */
|
/* Restore position */
|
||||||
if (RegQueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey,
|
if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("LastKey"),
|
||||||
_T("LastKey"),
|
szBuffer, COUNT_OF(szBuffer)) == ERROR_SUCCESS)
|
||||||
szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])) == ERROR_SUCCESS)
|
|
||||||
{
|
{
|
||||||
SelectNode(g_pChildWnd->hTreeWnd, szBuffer);
|
SelectNode(g_pChildWnd->hTreeWnd, szBuffer);
|
||||||
}
|
}
|
||||||
|
@ -183,31 +182,16 @@ BOOL TranslateChildTabMessage(MSG *msg)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
int APIENTRY wWinMain(HINSTANCE hInstance,
|
||||||
HINSTANCE hPrevInstance,
|
HINSTANCE hPrevInstance,
|
||||||
LPSTR lpCmdLine,
|
LPWSTR lpCmdLine,
|
||||||
int nCmdShow)
|
int nCmdShow)
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
HACCEL hAccel;
|
HACCEL hAccel;
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||||
|
|
||||||
/*
|
|
||||||
int hCrt;
|
|
||||||
FILE *hf;
|
|
||||||
AllocConsole();
|
|
||||||
hCrt = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
|
|
||||||
hf = _fdopen(hCrt, "w");
|
|
||||||
*stdout = *hf;
|
|
||||||
setvbuf(stdout, NULL, _IONBF, 0);
|
|
||||||
|
|
||||||
wprintf(L"command line exit, hInstance = %d\n", hInstance);
|
|
||||||
getch();
|
|
||||||
FreeConsole();
|
|
||||||
return 0;
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (ProcessCmdLine(lpCmdLine)) {
|
if (ProcessCmdLine(lpCmdLine)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,3 +124,10 @@ extern void DestroyMainMenu( void );
|
||||||
/* edit.c */
|
/* edit.c */
|
||||||
extern BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName, BOOL EditBin);
|
extern BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName, BOOL EditBin);
|
||||||
extern BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath);
|
extern BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath);
|
||||||
|
extern LONG RenameKey(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpNewName);
|
||||||
|
extern LONG RenameValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpDestValue, LPCTSTR lpSrcValue);
|
||||||
|
extern LONG QueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTSTR pszBuffer, DWORD dwBufferLen);
|
||||||
|
extern BOOL GetKeyName(LPTSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCTSTR lpSubKey);
|
||||||
|
|
||||||
|
/* security.c */
|
||||||
|
extern BOOL RegKeyEditPermissions(HWND hWndOwner, HKEY hKey, LPCTSTR lpMachine, LPCTSTR lpKeyName);
|
||||||
|
|
|
@ -56,7 +56,136 @@ typedef enum {
|
||||||
ACTION_UNDEF, ACTION_ADD, ACTION_EXPORT, ACTION_DELETE
|
ACTION_UNDEF, ACTION_ADD, ACTION_EXPORT, ACTION_DELETE
|
||||||
} REGEDIT_ACTION;
|
} REGEDIT_ACTION;
|
||||||
|
|
||||||
BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s);
|
|
||||||
|
const CHAR *getAppName(void)
|
||||||
|
{
|
||||||
|
return "regedit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Copies file name from command line string to the buffer.
|
||||||
|
* Rewinds the command line string pointer to the next non-space character
|
||||||
|
* after the file name.
|
||||||
|
* Buffer contains an empty string if no filename was found;
|
||||||
|
*
|
||||||
|
* params:
|
||||||
|
* command_line - command line current position pointer
|
||||||
|
* where *s[0] is the first symbol of the file name.
|
||||||
|
* file_name - buffer to write the file name to.
|
||||||
|
*/
|
||||||
|
void get_file_name(LPWSTR *command_line, LPWSTR file_name)
|
||||||
|
{
|
||||||
|
WCHAR *s = *command_line;
|
||||||
|
int pos = 0; /* position of pointer "s" in *command_line */
|
||||||
|
file_name[0] = 0;
|
||||||
|
|
||||||
|
if (!s[0]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s[0] == L'"') {
|
||||||
|
s++;
|
||||||
|
(*command_line)++;
|
||||||
|
while(s[0] != L'"') {
|
||||||
|
if (!s[0]) {
|
||||||
|
fprintf(stderr, "%s: Unexpected end of file name!\n", getAppName());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
s++;
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while(s[0] && !iswspace(s[0])) {
|
||||||
|
s++;
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memcpy(file_name, *command_line, pos * sizeof((*command_line)[0]));
|
||||||
|
/* remove the last backslash */
|
||||||
|
if (file_name[pos - 1] == L'\\') {
|
||||||
|
file_name[pos - 1] = L'\0';
|
||||||
|
} else {
|
||||||
|
file_name[pos] = L'\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s[0]) {
|
||||||
|
s++;
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
while(s[0] && iswspace(s[0])) {
|
||||||
|
s++;
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
(*command_line) += pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL PerformRegAction(REGEDIT_ACTION action, LPWSTR s)
|
||||||
|
{
|
||||||
|
switch (action) {
|
||||||
|
case ACTION_ADD: {
|
||||||
|
WCHAR filename[MAX_PATH];
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
get_file_name(&s, filename);
|
||||||
|
if (!filename[0]) {
|
||||||
|
fprintf(stderr, "%s: No file name is specified\n", getAppName());
|
||||||
|
fprintf(stderr, usage);
|
||||||
|
exit(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
while(filename[0]) {
|
||||||
|
fp = _wfopen(filename, L"r");
|
||||||
|
if (fp == NULL)
|
||||||
|
{
|
||||||
|
LPSTR p = GetMultiByteString(filename);
|
||||||
|
perror("");
|
||||||
|
fprintf(stderr, "%s: Can't open file \"%s\"\n", getAppName(), p);
|
||||||
|
HeapFree(GetProcessHeap(), 0, p);
|
||||||
|
exit(5);
|
||||||
|
}
|
||||||
|
import_registry_file(fp);
|
||||||
|
get_file_name(&s, filename);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ACTION_DELETE: {
|
||||||
|
WCHAR reg_key_name[KEY_MAX_LEN];
|
||||||
|
get_file_name(&s, reg_key_name);
|
||||||
|
if (!reg_key_name[0]) {
|
||||||
|
fprintf(stderr, "%s: No registry key is specified for removal\n", getAppName());
|
||||||
|
fprintf(stderr, usage);
|
||||||
|
exit(6);
|
||||||
|
}
|
||||||
|
delete_registry_key(reg_key_name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ACTION_EXPORT: {
|
||||||
|
WCHAR filename[MAX_PATH];
|
||||||
|
|
||||||
|
filename[0] = _T('\0');
|
||||||
|
get_file_name(&s, filename);
|
||||||
|
if (!filename[0]) {
|
||||||
|
fprintf(stderr, "%s: No file name is specified\n", getAppName());
|
||||||
|
fprintf(stderr, usage);
|
||||||
|
exit(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s[0]) {
|
||||||
|
WCHAR reg_key_name[KEY_MAX_LEN];
|
||||||
|
get_file_name(&s, reg_key_name);
|
||||||
|
export_registry_key(filename, reg_key_name, REG_FORMAT_4);
|
||||||
|
} else {
|
||||||
|
export_registry_key(filename, NULL, REG_FORMAT_4);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "%s: Unhandled action!\n", getAppName());
|
||||||
|
exit(8);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process unknown switch.
|
* Process unknown switch.
|
||||||
|
@ -65,46 +194,47 @@ BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s);
|
||||||
* chu - the switch character in upper-case.
|
* chu - the switch character in upper-case.
|
||||||
* s - the command line string where s points to the switch character.
|
* s - the command line string where s points to the switch character.
|
||||||
*/
|
*/
|
||||||
static void error_unknown_switch(char chu, char *s)
|
static void error_unknown_switch(WCHAR chu, LPWSTR s)
|
||||||
{
|
{
|
||||||
if (isalpha(chu)) {
|
if (iswalpha(chu)) {
|
||||||
fprintf(stderr,"%s: Undefined switch /%c!\n", getAppName(), chu);
|
fprintf(stderr, "%s: Undefined switch /%c!\n", getAppName(), chu);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr,"%s: Alphabetic character is expected after '%c' "
|
fprintf(stderr, "%s: Alphabetic character is expected after '%c' "
|
||||||
"in swit ch specification\n", getAppName(), *(s - 1));
|
"in swit ch specification\n", getAppName(), *(s - 1));
|
||||||
}
|
}
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ProcessCmdLine(LPSTR lpCmdLine)
|
BOOL ProcessCmdLine(LPWSTR lpCmdLine)
|
||||||
{
|
{
|
||||||
REGEDIT_ACTION action = ACTION_UNDEF;
|
REGEDIT_ACTION action = ACTION_UNDEF;
|
||||||
LPSTR s = lpCmdLine; /* command line pointer */
|
LPWSTR s = lpCmdLine; /* command line pointer */
|
||||||
CHAR ch = *s; /* current character */
|
WCHAR ch = *s; /* current character */
|
||||||
|
|
||||||
setAppName("regedit");
|
while (ch && ((ch == L'-') || (ch == L'/')))
|
||||||
while (ch && ((ch == '-') || (ch == '/'))) {
|
{
|
||||||
char chu;
|
WCHAR chu;
|
||||||
char ch2;
|
WCHAR ch2;
|
||||||
|
|
||||||
s++;
|
s++;
|
||||||
ch = *s;
|
ch = *s;
|
||||||
ch2 = *(s+1);
|
ch2 = *(s + 1);
|
||||||
chu = (CHAR) toupper(ch);
|
chu = (WCHAR)towupper(ch);
|
||||||
if (!ch2 || isspace(ch2)) {
|
if (!ch2 || iswspace(ch2)) {
|
||||||
if (chu == 'S' || chu == 'V') {
|
if (chu == L'S' || chu == L'V')
|
||||||
|
{
|
||||||
/* ignore these switches */
|
/* ignore these switches */
|
||||||
} else {
|
} else {
|
||||||
switch (chu) {
|
switch (chu) {
|
||||||
case 'D':
|
case L'D':
|
||||||
action = ACTION_DELETE;
|
action = ACTION_DELETE;
|
||||||
break;
|
break;
|
||||||
case 'E':
|
case L'E':
|
||||||
action = ACTION_EXPORT;
|
action = ACTION_EXPORT;
|
||||||
break;
|
break;
|
||||||
case '?':
|
case L'?':
|
||||||
fprintf(stderr,usage);
|
fprintf(stderr, usage);
|
||||||
exit(0);
|
exit(3);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error_unknown_switch(chu, s);
|
error_unknown_switch(chu, s);
|
||||||
|
@ -113,13 +243,13 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
|
||||||
}
|
}
|
||||||
s++;
|
s++;
|
||||||
} else {
|
} else {
|
||||||
if (ch2 == ':') {
|
if (ch2 == L':') {
|
||||||
switch (chu) {
|
switch (chu) {
|
||||||
case 'L':
|
case L'L':
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case 'R':
|
case L'R':
|
||||||
s += 2;
|
s += 2;
|
||||||
while (*s && !isspace(*s)) {
|
while (*s && !iswspace(*s)) {
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -135,7 +265,7 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
|
||||||
}
|
}
|
||||||
/* skip spaces to the next parameter */
|
/* skip spaces to the next parameter */
|
||||||
ch = *s;
|
ch = *s;
|
||||||
while (ch && isspace(ch)) {
|
while (ch && iswspace(ch)) {
|
||||||
s++;
|
s++;
|
||||||
ch = *s;
|
ch = *s;
|
||||||
}
|
}
|
||||||
|
@ -149,85 +279,3 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
|
||||||
|
|
||||||
return PerformRegAction(action, s);
|
return PerformRegAction(action, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s)
|
|
||||||
{
|
|
||||||
switch (action) {
|
|
||||||
case ACTION_ADD: {
|
|
||||||
CHAR filename[MAX_PATH];
|
|
||||||
FILE *reg_file;
|
|
||||||
|
|
||||||
get_file_name(&s, filename);
|
|
||||||
if (!filename[0]) {
|
|
||||||
fprintf(stderr,"%s: No file name is specified\n", getAppName());
|
|
||||||
fprintf(stderr,usage);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while(filename[0]) {
|
|
||||||
reg_file = fopen(filename, "r");
|
|
||||||
if (reg_file) {
|
|
||||||
processRegLines(reg_file, doSetValue);
|
|
||||||
fclose(reg_file);
|
|
||||||
} else {
|
|
||||||
perror("");
|
|
||||||
fprintf(stderr,"%s: Can't open file \"%s\"\n", getAppName(), filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
get_file_name(&s, filename);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ACTION_DELETE: {
|
|
||||||
CHAR reg_key_name[KEY_MAX_LEN];
|
|
||||||
|
|
||||||
get_file_name(&s, reg_key_name);
|
|
||||||
if (!reg_key_name[0]) {
|
|
||||||
fprintf(stderr,"%s: No registry key is specified for removal\n",
|
|
||||||
getAppName());
|
|
||||||
fprintf(stderr,usage);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
delete_registry_key(reg_key_name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ACTION_EXPORT: {
|
|
||||||
CHAR filename[MAX_PATH];
|
|
||||||
LPCTSTR pszFilename;
|
|
||||||
#ifdef UNICODE
|
|
||||||
WCHAR filename_wide[MAX_PATH];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
filename[0] = '\0';
|
|
||||||
get_file_name(&s, filename);
|
|
||||||
if (!filename[0]) {
|
|
||||||
fprintf(stderr,"%s: No file name is specified\n", getAppName());
|
|
||||||
fprintf(stderr,usage);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef UNICODE
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, filename, -1, filename_wide,
|
|
||||||
sizeof(filename_wide) / sizeof(filename_wide[0]));
|
|
||||||
pszFilename = filename_wide;
|
|
||||||
#else
|
|
||||||
pszFilename = filename;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (s[0]) {
|
|
||||||
CHAR reg_key_name[KEY_MAX_LEN];
|
|
||||||
|
|
||||||
get_file_name(&s, reg_key_name);
|
|
||||||
export_registry_key(pszFilename, reg_key_name);
|
|
||||||
} else {
|
|
||||||
export_registry_key(pszFilename, NULL);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
fprintf(stderr,"%s: Unhandled action!\n", getAppName());
|
|
||||||
exit(1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
|
<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
|
||||||
<group xmlns:xi="http://www.w3.org/2001/XInclude">
|
<group xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
<module name="regedit" type="win32gui" installname="regedit.exe">
|
<module name="regedit" type="win32gui" installname="regedit.exe" unicode="yes">
|
||||||
<include base="regedit">.</include>
|
<include base="regedit">.</include>
|
||||||
<define name="UNICODE" />
|
<define name="UNICODE" />
|
||||||
<define name="_UNICODE" />
|
<define name="_UNICODE" />
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -17,81 +17,15 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* Defines and consts
|
|
||||||
*/
|
|
||||||
#define KEY_MAX_LEN 1024
|
#define KEY_MAX_LEN 1024
|
||||||
|
|
||||||
/* Return values */
|
#define REG_FORMAT_5 1
|
||||||
#define SUCCESS 0
|
#define REG_FORMAT_4 2
|
||||||
#define KEY_VALUE_ALREADY_SET 2
|
|
||||||
|
|
||||||
extern HINSTANCE hInst;
|
|
||||||
|
|
||||||
typedef void (*CommandAPI)(LPSTR lpsLine);
|
|
||||||
|
|
||||||
void doSetValue(LPSTR lpsLine);
|
|
||||||
void doDeleteValue(LPSTR lpsLine);
|
|
||||||
void doCreateKey(LPSTR lpsLine);
|
|
||||||
void doDeleteKey(LPSTR lpsLine);
|
|
||||||
void doRegisterDLL(LPSTR lpsLine);
|
|
||||||
void doUnregisterDLL(LPSTR lpsLine);
|
|
||||||
|
|
||||||
BOOL export_registry_key(const TCHAR *file_name, CHAR *reg_key_name);
|
|
||||||
BOOL import_registry_file(LPTSTR filename);
|
|
||||||
void delete_registry_key(CHAR *reg_key_name);
|
|
||||||
|
|
||||||
void setAppName(const CHAR *name);
|
|
||||||
const CHAR *getAppName(void);
|
const CHAR *getAppName(void);
|
||||||
|
|
||||||
void processRegLines(FILE *in, CommandAPI command);
|
BOOL export_registry_key(WCHAR *file_name, WCHAR *reg_key_name, DWORD format);
|
||||||
|
BOOL import_registry_file(FILE* reg_file);
|
||||||
/*
|
void delete_registry_key(LPTSTR reg_key_name);
|
||||||
* Generic prototypes
|
WCHAR* GetWideString(const char* strA);
|
||||||
*/
|
CHAR* GetMultiByteString(const WCHAR* strW);
|
||||||
char* getToken(char** str, const char* delims);
|
|
||||||
void get_file_name(CHAR **command_line, CHAR *filename);
|
|
||||||
LPSTR convertHexToHexCSV( BYTE *buf, ULONG len);
|
|
||||||
LPSTR convertHexToDWORDStr( BYTE *buf, ULONG len);
|
|
||||||
LPSTR getRegKeyName(LPSTR lpLine);
|
|
||||||
BOOL getRegClass(LPSTR lpLine, HKEY* hkey);
|
|
||||||
DWORD getDataType(LPSTR *lpValue, DWORD* parse_type);
|
|
||||||
LPSTR getArg(LPSTR arg);
|
|
||||||
HRESULT openKey(LPSTR stdInput);
|
|
||||||
void closeKey(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* api setValue prototypes
|
|
||||||
*/
|
|
||||||
void processSetValue(LPSTR cmdline);
|
|
||||||
HRESULT setValue(LPSTR val_name, LPSTR val_data);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Permission prototypes
|
|
||||||
*/
|
|
||||||
|
|
||||||
BOOL InitializeAclUiDll(VOID);
|
|
||||||
VOID UnloadAclUiDll(VOID);
|
|
||||||
BOOL RegKeyEditPermissions(HWND hWndOwner, HKEY hKey, LPCTSTR lpMachine, LPCTSTR lpKeyName);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Processing
|
|
||||||
*/
|
|
||||||
LONG RegCopyKey(HKEY hDestKey, LPCTSTR lpDestSubKey, HKEY hSrcKey, LPCTSTR lpSrcSubKey);
|
|
||||||
LONG RegMoveKey(HKEY hDestKey, LPCTSTR lpDestSubKey, HKEY hSrcKey, LPCTSTR lpSrcSubKey);
|
|
||||||
LONG RegRenameKey(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpNewName);
|
|
||||||
LONG RegRenameValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpDestValue, LPCTSTR lpSrcValue);
|
|
||||||
LONG RegQueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTSTR pszBuffer, DWORD dwBufferLen);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Miscellaneous
|
|
||||||
*/
|
|
||||||
#define RSF_WHOLESTRING 0x00000001
|
|
||||||
#define RSF_LOOKATKEYS 0x00000002
|
|
||||||
#define RSF_LOOKATVALUES 0x00000004
|
|
||||||
#define RSF_LOOKATDATA 0x00000008
|
|
||||||
#define RSF_MATCHCASE 0x00010000
|
|
||||||
|
|
||||||
BOOL RegKeyGetName(LPTSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCTSTR lpSubKey);
|
|
||||||
|
|
||||||
/* EOF */
|
|
||||||
|
|
Loading…
Reference in a new issue