Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a6a4109d
Commit
a6a4109d
authored
Aug 21, 2008
by
Alexander Nicolaysen Sørnes
Committed by
Alexandre Julliard
Aug 22, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: Convert key creation to unicode.
parent
f2080252
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
16 deletions
+25
-16
edit.c
programs/regedit/edit.c
+7
-7
framewnd.c
programs/regedit/framewnd.c
+7
-2
main.h
programs/regedit/main.h
+2
-2
treeview.c
programs/regedit/treeview.c
+9
-5
No files found.
programs/regedit/edit.c
View file @
a6a4109d
...
...
@@ -242,33 +242,33 @@ done:
return
NULL
;
}
BOOL
CreateKey
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
TSTR
keyPath
,
LPT
STR
keyName
)
BOOL
CreateKey
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
WSTR
keyPath
,
LPW
STR
keyName
)
{
BOOL
result
=
FALSE
;
LONG
lRet
=
ERROR_SUCCESS
;
HKEY
retKey
=
NULL
;
T
CHAR
newKey
[
MAX_NEW_KEY_LEN
-
4
];
W
CHAR
newKey
[
MAX_NEW_KEY_LEN
-
4
];
int
keyNum
;
HKEY
hKey
;
lRet
=
RegOpenKeyEx
(
hKeyRoot
,
keyPath
,
0
,
KEY_CREATE_SUB_KEY
,
&
hKey
);
lRet
=
RegOpenKeyEx
W
(
hKeyRoot
,
keyPath
,
0
,
KEY_CREATE_SUB_KEY
,
&
hKey
);
if
(
lRet
!=
ERROR_SUCCESS
)
{
error_code_messagebox
(
hwnd
,
lRet
);
goto
done
;
}
if
(
!
LoadString
(
GetModuleHandle
(
0
),
IDS_NEWKEY
,
newKey
,
COUNT_OF
(
newKey
)))
goto
done
;
if
(
!
LoadString
W
(
GetModuleHandle
(
0
),
IDS_NEWKEY
,
newKey
,
COUNT_OF
(
newKey
)))
goto
done
;
/* 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
);
wsprintf
W
(
keyName
,
newKey
,
keyNum
);
lRet
=
RegOpenKey
W
(
hKey
,
keyName
,
&
retKey
);
if
(
lRet
!=
ERROR_SUCCESS
)
break
;
RegCloseKey
(
retKey
);
}
if
(
lRet
==
ERROR_SUCCESS
)
goto
done
;
lRet
=
RegCreateKey
(
hKey
,
keyName
,
&
retKey
);
lRet
=
RegCreateKey
W
(
hKey
,
keyName
,
&
retKey
);
if
(
lRet
!=
ERROR_SUCCESS
)
{
error_code_messagebox
(
hwnd
,
lRet
);
goto
done
;
...
...
programs/regedit/framewnd.c
View file @
a6a4109d
...
...
@@ -761,10 +761,15 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break
;
}
case
ID_EDIT_NEW_KEY
:
if
(
CreateKey
(
hWnd
,
hKeyRoot
,
keyPath
,
newKey
))
{
if
(
InsertNode
(
g_pChildWnd
->
hTreeWnd
,
0
,
newKey
))
{
WCHAR
newKeyW
[
MAX_NEW_KEY_LEN
];
WCHAR
*
keyPathW
=
GetWideString
(
keyPath
);
if
(
CreateKey
(
hWnd
,
hKeyRoot
,
keyPathW
,
newKeyW
))
{
if
(
InsertNode
(
g_pChildWnd
->
hTreeWnd
,
0
,
newKeyW
))
StartKeyRename
(
g_pChildWnd
->
hTreeWnd
);
}
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
}
break
;
case
ID_EDIT_NEW_STRINGVALUE
:
valueType
=
REG_SZ
;
...
...
programs/regedit/main.h
View file @
a6a4109d
...
...
@@ -134,13 +134,13 @@ extern BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEW* pnmtv);
extern
LPTSTR
GetItemPath
(
HWND
hwndTV
,
HTREEITEM
hItem
,
HKEY
*
phRootKey
);
extern
LPWSTR
GetItemPathW
(
HWND
hwndTV
,
HTREEITEM
hItem
,
HKEY
*
phRootKey
);
extern
BOOL
DeleteNode
(
HWND
hwndTV
,
HTREEITEM
hItem
);
extern
HTREEITEM
InsertNode
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LP
T
STR
name
);
extern
HTREEITEM
InsertNode
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LP
W
STR
name
);
extern
HWND
StartKeyRename
(
HWND
hwndTV
);
extern
HTREEITEM
FindPathInTree
(
HWND
hwndTV
,
LPCTSTR
lpKeyName
);
extern
HTREEITEM
FindNext
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LPCTSTR
sstring
,
int
mode
,
int
*
row
);
/* edit.c */
extern
BOOL
CreateKey
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
TSTR
keyPath
,
LPT
STR
newKeyName
);
extern
BOOL
CreateKey
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
WSTR
keyPath
,
LPW
STR
newKeyName
);
extern
BOOL
CreateValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPCTSTR
keyPath
,
DWORD
valueType
,
LPTSTR
valueName
);
extern
BOOL
ModifyValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPCTSTR
keyPath
,
LPCTSTR
valueName
);
extern
BOOL
DeleteKey
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPCWSTR
keyPath
);
...
...
programs/regedit/treeview.c
View file @
a6a4109d
...
...
@@ -518,7 +518,7 @@ BOOL RefreshTreeView(HWND hwndTV)
return
TRUE
;
}
HTREEITEM
InsertNode
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LP
T
STR
name
)
HTREEITEM
InsertNode
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LP
W
STR
name
)
{
TCHAR
buf
[
MAX_NEW_KEY_LEN
];
HTREEITEM
hNewItem
=
0
;
...
...
@@ -527,7 +527,9 @@ HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPTSTR name)
if
(
!
hItem
)
hItem
=
TreeView_GetSelection
(
hwndTV
);
if
(
!
hItem
)
return
FALSE
;
if
(
TreeView_GetItemState
(
hwndTV
,
hItem
,
TVIS_EXPANDEDONCE
))
{
hNewItem
=
AddEntryToTree
(
hwndTV
,
hItem
,
name
,
0
,
0
);
char
*
nameA
=
GetMultiByteString
(
name
);
hNewItem
=
AddEntryToTree
(
hwndTV
,
hItem
,
nameA
,
0
,
0
);
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
}
else
{
item
.
mask
=
TVIF_CHILDREN
|
TVIF_HANDLE
;
item
.
hItem
=
hItem
;
...
...
@@ -535,19 +537,21 @@ HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPTSTR name)
item
.
cChildren
=
1
;
if
(
!
TreeView_SetItem
(
hwndTV
,
&
item
))
return
FALSE
;
}
SendMessage
(
hwndTV
,
TVM_EXPAND
,
TVE_EXPAND
,
(
LPARAM
)
hItem
);
SendMessage
W
(
hwndTV
,
TVM_EXPAND
,
TVE_EXPAND
,
(
LPARAM
)
hItem
);
if
(
!
hNewItem
)
{
char
*
nameA
=
GetMultiByteString
(
name
);
for
(
hNewItem
=
TreeView_GetChild
(
hwndTV
,
hItem
);
hNewItem
;
hNewItem
=
TreeView_GetNextSibling
(
hwndTV
,
hNewItem
))
{
item
.
mask
=
TVIF_HANDLE
|
TVIF_TEXT
;
item
.
hItem
=
hNewItem
;
item
.
pszText
=
buf
;
item
.
cchTextMax
=
COUNT_OF
(
buf
);
if
(
!
TreeView_GetItem
(
hwndTV
,
&
item
))
continue
;
if
(
lstrcmp
(
name
,
item
.
pszText
)
==
0
)
break
;
if
(
lstrcmp
(
name
A
,
item
.
pszText
)
==
0
)
break
;
}
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
}
if
(
hNewItem
)
SendMessage
(
hwndTV
,
TVM_SELECTITEM
,
TVGN_CARET
,
(
LPARAM
)
hNewItem
);
SendMessage
W
(
hwndTV
,
TVM_SELECTITEM
,
TVGN_CARET
,
(
LPARAM
)
hNewItem
);
return
hNewItem
;
}
...
...
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