Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b3130b9f
Commit
b3130b9f
authored
Jan 06, 2004
by
Dimitrie O. Paun
Committed by
Alexandre Julliard
Jan 06, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new value support. Misc improvements and cleanups.
parent
ccd74968
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
19 deletions
+58
-19
En.rc
programs/regedit/En.rc
+2
-1
edit.c
programs/regedit/edit.c
+40
-18
framewnd.c
programs/regedit/framewnd.c
+14
-0
main.h
programs/regedit/main.h
+1
-0
resource.h
programs/regedit/resource.h
+1
-0
No files found.
programs/regedit/En.rc
View file @
b3130b9f
...
...
@@ -218,7 +218,8 @@ BEGIN
IDS_TOO_BIG_VALUE "Value is too big (%ld)"
IDS_DELETE_BOX_TITLE "Confirm Value Delete"
IDS_DELETE_BOX_TEXT "Are you sure you want to delete value '%s'?"
IDS_NEWKEY "New Key"
IDS_NEWKEY "New Key #%d"
IDS_NEWVALUE "New Value #%d"
END
/*****************************************************************/
...
...
programs/regedit/edit.c
View file @
b3130b9f
...
...
@@ -127,36 +127,31 @@ INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
BOOL
CreateKey
(
HKEY
hKey
)
{
LONG
lRet
;
LONG
lRet
=
ERROR_SUCCESS
;
HKEY
retKey
;
TCHAR
keyName
[
32
];
static
TCHAR
newKey
[
28
]
=
""
;
/* should be max keyName len - 4 */
HINSTANCE
hInstance
;
unsigned
int
keyNum
=
1
;
TCHAR
newKey
[
COUNT_OF
(
keyName
)
-
4
];
int
keyNum
;
/* If we have illegal parameter return with operation failure */
if
(
!
hKey
)
return
FALSE
;
/* Load localized "new key" string. -4 is because we need max 4 character
to numbering. */
if
(
newKey
[
0
]
==
0
)
{
hInstance
=
GetModuleHandle
(
0
);
if
(
!
LoadString
(
hInstance
,
IDS_NEWKEY
,
newKey
,
COUNT_OF
(
newKey
)))
lstrcpy
(
newKey
,
"New Key"
);
}
lstrcpy
(
keyName
,
newKey
);
if
(
!
LoadString
(
GetModuleHandle
(
0
),
IDS_NEWKEY
,
newKey
,
COUNT_OF
(
newKey
)))
return
FALSE
;
/* try to find out a name for the newly create key.
We try it max 100 times. */
lRet
=
RegOpenKey
(
hKey
,
keyName
,
&
retKey
);
while
(
lRet
==
ERROR_SUCCESS
&&
keyNum
<
100
)
{
wsprintf
(
keyName
,
"%s %u"
,
newKey
,
++
keyNum
);
/* try to find out a name for the newly create key (max 100 times) */
for
(
keyNum
=
1
;
keyNum
<
100
;
keyNum
++
)
{
wsprintf
(
keyName
,
newKey
,
keyNum
);
lRet
=
RegOpenKey
(
hKey
,
keyName
,
&
retKey
);
if
(
lRet
!=
ERROR_SUCCESS
)
break
;
RegCloseKey
(
retKey
);
}
if
(
lRet
==
ERROR_SUCCESS
)
return
FALSE
;
lRet
=
RegCreateKey
(
hKey
,
keyName
,
&
retKey
);
return
lRet
==
ERROR_SUCCESS
;
if
(
lRet
!=
ERROR_SUCCESS
)
return
FALSE
;
RegCloseKey
(
retKey
);
return
TRUE
;
}
BOOL
ModifyValue
(
HWND
hwnd
,
HKEY
hKey
,
LPCTSTR
valueName
)
...
...
@@ -226,3 +221,30 @@ BOOL DeleteValue(HWND hwnd, HKEY hKey, LPCTSTR valueName)
}
return
lRet
==
ERROR_SUCCESS
;
}
BOOL
CreateValue
(
HWND
hwnd
,
HKEY
hKey
,
DWORD
valueType
)
{
LONG
lRet
=
ERROR_SUCCESS
;
TCHAR
valueName
[
32
];
TCHAR
newValue
[
COUNT_OF
(
valueName
)
-
4
];
DWORD
valueDword
=
0
;
int
valueNum
;
/* If we have illegal parameter return with operation failure */
if
(
!
hKey
)
return
FALSE
;
if
(
!
LoadString
(
GetModuleHandle
(
0
),
IDS_NEWVALUE
,
newValue
,
COUNT_OF
(
newValue
)))
return
FALSE
;
/* try to find out a name for the newly create key (max 100 times) */
for
(
valueNum
=
1
;
valueNum
<
100
;
valueNum
++
)
{
wsprintf
(
valueName
,
newValue
,
valueNum
);
lRet
=
RegQueryValueEx
(
hKey
,
valueName
,
0
,
0
,
0
,
0
);
if
(
lRet
!=
ERROR_SUCCESS
)
break
;
}
if
(
lRet
==
ERROR_SUCCESS
)
return
FALSE
;
lRet
=
RegSetValueEx
(
hKey
,
valueName
,
0
,
valueType
,
(
BYTE
*
)
&
valueDword
,
sizeof
(
DWORD
));
if
(
lRet
!=
ERROR_SUCCESS
)
return
FALSE
;
return
TRUE
;
}
programs/regedit/framewnd.c
View file @
b3130b9f
...
...
@@ -440,6 +440,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
LPCTSTR
valueName
;
BOOL
result
=
TRUE
;
LONG
lRet
;
DWORD
valueType
;
if
((
keyPath
=
GetItemPath
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
)))
{
lRet
=
RegOpenKeyEx
(
hKeyRoot
,
keyPath
,
0
,
KEY_ALL_ACCESS
,
&
hKey
);
...
...
@@ -475,6 +476,19 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case
ID_EDIT_NEW_KEY
:
CreateKey
(
hKey
);
break
;
case
ID_EDIT_NEW_STRINGVALUE
:
valueType
=
REG_SZ
;
goto
create_value
;
case
ID_EDIT_NEW_BINARYVALUE
:
valueType
=
REG_BINARY
;
goto
create_value
;
case
ID_EDIT_NEW_DWORDVALUE
:
valueType
=
REG_DWORD
;
/* fall through */
create_value:
if
(
CreateValue
(
hWnd
,
hKey
,
valueType
))
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPath
);
break
;
case
ID_REGISTRY_PRINTERSETUP
:
/*PRINTDLG pd;*/
/*PrintDlg(&pd);*/
...
...
programs/regedit/main.h
View file @
b3130b9f
...
...
@@ -94,6 +94,7 @@ extern LPCTSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
/* edit.c */
extern
BOOL
CreateKey
(
HKEY
hKey
);
extern
BOOL
CreateValue
(
HWND
hwnd
,
HKEY
hKey
,
DWORD
valueType
);
extern
BOOL
ModifyValue
(
HWND
hwnd
,
HKEY
hKey
,
LPCTSTR
valueName
);
extern
BOOL
DeleteValue
(
HWND
hwnd
,
HKEY
hKey
,
LPCTSTR
valueName
);
...
...
programs/regedit/resource.h
View file @
b3130b9f
...
...
@@ -113,6 +113,7 @@
#define IDC_DWORD_HEX 32853
#define IDC_DWORD_DEC 32854
#define IDS_NEWKEY 32860
#define IDS_NEWVALUE 32861
#define IDD_EDIT_STRING 2000
#define IDC_VALUE_NAME 2001
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment