mirror of
https://github.com/reactos/reactos.git
synced 2024-07-29 23:58:44 +00:00
Regedit: Now restores last position on startup
Still need to save position on exit svn path=/trunk/; revision=18270
This commit is contained in:
parent
3df2610b06
commit
f8b4f3f219
|
@ -34,6 +34,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "hexedit.h"
|
#include "hexedit.h"
|
||||||
#include "security.h"
|
#include "security.h"
|
||||||
|
#include "regproc.h"
|
||||||
|
|
||||||
BOOL ProcessCmdLine(LPSTR lpCmdLine);
|
BOOL ProcessCmdLine(LPSTR lpCmdLine);
|
||||||
|
|
||||||
|
@ -74,6 +75,8 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
{
|
{
|
||||||
BOOL AclUiAvailable;
|
BOOL AclUiAvailable;
|
||||||
HMENU hEditMenu;
|
HMENU hEditMenu;
|
||||||
|
TCHAR szBuffer[256];
|
||||||
|
LPCTSTR s;
|
||||||
|
|
||||||
WNDCLASSEX wcFrame = {
|
WNDCLASSEX wcFrame = {
|
||||||
sizeof(WNDCLASSEX),
|
sizeof(WNDCLASSEX),
|
||||||
|
@ -158,6 +161,19 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
SetupStatusBar(hFrameWnd, FALSE);
|
SetupStatusBar(hFrameWnd, FALSE);
|
||||||
CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
|
CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Restore position */
|
||||||
|
if (RegQueryStringValue(HKEY_CURRENT_USER,
|
||||||
|
_T("Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Regedit"),
|
||||||
|
_T("LastKey"),
|
||||||
|
szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
s = szBuffer;
|
||||||
|
if (!_tcsncmp(s, _T("My Computer\\"), 12))
|
||||||
|
s += 12;
|
||||||
|
SelectNode(g_pChildWnd->hTreeWnd, s);
|
||||||
|
}
|
||||||
|
|
||||||
ShowWindow(hFrameWnd, nCmdShow);
|
ShowWindow(hFrameWnd, nCmdShow);
|
||||||
UpdateWindow(hFrameWnd);
|
UpdateWindow(hFrameWnd);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -1659,8 +1659,42 @@ LONG RegRenameValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpDestValue, LPCTSTR lp
|
||||||
RegDeleteValue(hKey, lpSrcValue);
|
RegDeleteValue(hKey, lpSrcValue);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (hKey)
|
if (hSubKey)
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hSubKey);
|
||||||
|
return lResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
LONG RegQueryStringValue(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)] = '\0';
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (lResult != ERROR_SUCCESS)
|
||||||
|
pszBuffer[0] = '\0';
|
||||||
|
if (hSubKey)
|
||||||
|
RegCloseKey(hSubKey);
|
||||||
return lResult;
|
return lResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,7 @@ LONG RegCopyKey(HKEY hDestKey, LPCTSTR lpDestSubKey, HKEY hSrcKey, LPCTSTR lpSrc
|
||||||
LONG RegMoveKey(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 RegRenameKey(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpNewName);
|
||||||
LONG RegRenameValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpDestValue, LPCTSTR lpSrcValue);
|
LONG RegRenameValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpDestValue, LPCTSTR lpSrcValue);
|
||||||
|
LONG RegQueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTSTR pszBuffer, DWORD dwBufferLen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Miscellaneous
|
* Miscellaneous
|
||||||
|
|
Loading…
Reference in a new issue