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
6c486058
Commit
6c486058
authored
Apr 16, 2019
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineboot: Also process Run keys from the 32-bit registry view.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0d17f36c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
81 deletions
+72
-81
wineboot.c
programs/wineboot/wineboot.c
+72
-81
No files found.
programs/wineboot/wineboot.c
View file @
6c486058
...
...
@@ -90,6 +90,7 @@ extern BOOL shutdown_all_desktops( BOOL force );
extern
void
kill_processes
(
BOOL
kill_desktop
);
static
WCHAR
windowsdir
[
MAX_PATH
];
static
const
BOOL
is_64bit
=
sizeof
(
void
*
)
>
sizeof
(
int
);
/* retrieve the (unix) path to the wine.inf file */
static
char
*
get_wine_inf_path
(
void
)
...
...
@@ -765,119 +766,109 @@ static DWORD runCmd(LPWSTR cmdline, LPCWSTR dir, BOOL wait, BOOL minimized)
return
exit_code
;
}
/*
* Process a "Run" type registry key.
* hkRoot is the HKEY from which "Software\Microsoft\Windows\CurrentVersion" is
* opened.
* szKeyName is the key holding the actual entries.
* bDelete tells whether we should delete each value right before executing it.
* bSynchronous tells whether we should wait for the prog to complete before
* going on to the next prog.
*/
static
BOOL
ProcessRunKeys
(
HKEY
hkRoot
,
LPCWSTR
szKeyName
,
BOOL
bDelete
,
BOOL
bSynchronous
)
static
void
process_run_key
(
HKEY
key
,
const
WCHAR
*
keyname
,
BOOL
delete
,
BOOL
synchronous
)
{
static
const
WCHAR
WINKEY_NAME
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
0
};
HKEY
hkWin
,
hkRun
;
DWORD
res
,
dispos
;
DWORD
i
,
nMaxCmdLine
=
0
,
nMaxValue
=
0
;
WCHAR
*
szCmdLine
=
NULL
;
WCHAR
*
szValue
=
NULL
;
if
(
hkRoot
==
HKEY_LOCAL_MACHINE
)
WINE_TRACE
(
"processing %s entries under HKLM
\n
"
,
wine_dbgstr_w
(
szKeyName
)
);
else
WINE_TRACE
(
"processing %s entries under HKCU
\n
"
,
wine_dbgstr_w
(
szKeyName
)
);
HKEY
runkey
;
LONG
res
;
DWORD
disp
,
i
,
max_cmdline
=
0
,
max_value
=
0
;
WCHAR
*
cmdline
=
NULL
,
*
value
=
NULL
;
if
(
RegCreateKeyExW
(
hkRoot
,
WINKEY_NAME
,
0
,
NULL
,
0
,
KEY_READ
,
NULL
,
&
hkWin
,
NULL
)
!=
ERROR_SUCCESS
)
return
TRUE
;
if
(
RegCreateKeyExW
(
key
,
keyname
,
0
,
NULL
,
0
,
delete
?
KEY_ALL_ACCESS
:
KEY_READ
,
NULL
,
&
runkey
,
&
disp
)
)
return
;
if
((
res
=
RegCreateKeyExW
(
hkWin
,
szKeyName
,
0
,
NULL
,
0
,
bDelete
?
KEY_ALL_ACCESS
:
KEY_READ
,
NULL
,
&
hkRun
,
&
dispos
))
!=
ERROR_SUCCESS
)
{
RegCloseKey
(
hkWin
);
return
TRUE
;
}
RegCloseKey
(
hkWin
);
if
(
dispos
==
REG_CREATED_NEW_KEY
)
goto
end
;
if
(
disp
==
REG_CREATED_NEW_KEY
)
goto
end
;
if
(
(
res
=
RegQueryInfoKeyW
(
hkRun
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
&
i
,
&
nMaxValue
,
&
nMaxCmdLine
,
NULL
,
NULL
))
!=
ERROR_SUCCESS
)
if
(
RegQueryInfoKeyW
(
runkey
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
&
i
,
&
max_value
,
&
max_cmdline
,
NULL
,
NULL
))
goto
end
;
if
(
i
==
0
)
if
(
!
i
)
{
WINE_TRACE
(
"No commands to execute.
\n
"
);
res
=
ERROR_SUCCESS
;
WINE_TRACE
(
"No commands to execute.
\n
"
);
goto
end
;
}
if
(
(
szCmdLine
=
HeapAlloc
(
GetProcessHeap
(),
0
,
nMaxCmdLine
))
==
NULL
)
if
(
!
(
cmdline
=
HeapAlloc
(
GetProcessHeap
(),
0
,
max_cmdline
)))
{
WINE_ERR
(
"Couldn't allocate memory for the commands to be executed
\n
"
);
res
=
ERROR_NOT_ENOUGH_MEMORY
;
WINE_ERR
(
"Couldn't allocate memory for the commands to be executed.
\n
"
);
goto
end
;
}
if
(
(
szValue
=
HeapAlloc
(
GetProcessHeap
(),
0
,(
++
nMaxValue
)
*
sizeof
(
*
szValue
)))
==
NULL
)
if
(
!
(
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
++
max_value
*
sizeof
(
*
value
)
)))
{
WINE_ERR
(
"Couldn't allocate memory for the value names
\n
"
);
res
=
ERROR_NOT_ENOUGH_MEMORY
;
WINE_ERR
(
"Couldn't allocate memory for the value names.
\n
"
);
goto
end
;
}
while
(
i
>
0
)
{
DWORD
nValLength
=
nMaxValue
,
nDataLength
=
nMaxCmdLine
;
DWORD
type
;
--
i
;
while
(
i
)
{
DWORD
len
=
max_value
,
len_data
=
max_cmdline
,
type
;
if
(
(
res
=
RegEnumValueW
(
hkRun
,
i
,
szValue
,
&
nValLength
,
0
,
&
type
,
(
LPBYTE
)
szCmdLine
,
&
nDataLength
))
!=
ERROR_SUCCESS
)
if
((
res
=
RegEnumValueW
(
runkey
,
--
i
,
value
,
&
len
,
0
,
&
type
,
(
BYTE
*
)
cmdline
,
&
len_data
)))
{
WINE_ERR
(
"Couldn't read in value %d - %d
\n
"
,
i
,
res
);
WINE_ERR
(
"Couldn't read value %u (%d).
\n
"
,
i
,
res
);
continue
;
}
if
(
bDelete
&&
(
res
=
RegDeleteValueW
(
hkRun
,
szValue
))
!=
ERROR_SUCCESS
)
if
(
delete
&&
(
res
=
RegDeleteValueW
(
runkey
,
value
)))
{
WINE_ERR
(
"Couldn't delete value - %d, %d
. Running command anyways.
\n
"
,
i
,
res
);
WINE_ERR
(
"Couldn't delete value %u (%d)
. Running command anyways.
\n
"
,
i
,
res
);
}
if
(
type
!=
REG_SZ
)
if
(
type
!=
REG_SZ
)
{
WINE_ERR
(
"Incorrect type of value #%d (%d)
\n
"
,
i
,
type
);
WINE_ERR
(
"Incorrect type of value %u (%u).
\n
"
,
i
,
type
);
continue
;
}
if
(
(
res
=
runCmd
(
szCmdLine
,
NULL
,
bSynchronous
,
FALSE
))
==
INVALID_RUNCMD_RETURN
)
if
(
runCmd
(
cmdline
,
NULL
,
synchronous
,
FALSE
)
==
INVALID_RUNCMD_RETURN
)
{
WINE_ERR
(
"Error running cmd %s (%d)
\n
"
,
wine_dbgstr_w
(
szCmdL
ine
),
GetLastError
()
);
WINE_ERR
(
"Error running cmd %s (%u).
\n
"
,
wine_dbgstr_w
(
cmdl
ine
),
GetLastError
()
);
}
WINE_TRACE
(
"Done processing cmd #%d
\n
"
,
i
);
WINE_TRACE
(
"Done processing cmd %u.
\n
"
,
i
);
}
res
=
ERROR_SUCCESS
;
end
:
HeapFree
(
GetProcessHeap
(),
0
,
szV
alue
);
HeapFree
(
GetProcessHeap
(),
0
,
szCmdL
ine
);
if
(
hkRun
!=
NULL
)
RegCloseKey
(
hkRun
);
HeapFree
(
GetProcessHeap
(),
0
,
v
alue
);
HeapFree
(
GetProcessHeap
(),
0
,
cmdl
ine
);
RegCloseKey
(
runkey
);
WINE_TRACE
(
"Done.
\n
"
);
}
WINE_TRACE
(
"done
\n
"
);
/*
* Process a "Run" type registry key.
* hkRoot is the HKEY from which "Software\Microsoft\Windows\CurrentVersion" is
* opened.
* szKeyName is the key holding the actual entries.
* bDelete tells whether we should delete each value right before executing it.
* bSynchronous tells whether we should wait for the prog to complete before
* going on to the next prog.
*/
static
void
ProcessRunKeys
(
HKEY
root
,
const
WCHAR
*
keyname
,
BOOL
delete
,
BOOL
synchronous
)
{
static
const
WCHAR
keypathW
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
0
};
HKEY
key
;
return
res
==
ERROR_SUCCESS
;
if
(
root
==
HKEY_LOCAL_MACHINE
)
{
WINE_TRACE
(
"Processing %s entries under HKLM.
\n
"
,
wine_dbgstr_w
(
keyname
)
);
if
(
!
RegCreateKeyExW
(
root
,
keypathW
,
0
,
NULL
,
0
,
KEY_READ
,
NULL
,
&
key
,
NULL
))
{
process_run_key
(
key
,
keyname
,
delete
,
synchronous
);
RegCloseKey
(
key
);
}
if
(
is_64bit
&&
!
RegCreateKeyExW
(
root
,
keypathW
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WOW64_32KEY
,
NULL
,
&
key
,
NULL
))
{
process_run_key
(
key
,
keyname
,
delete
,
synchronous
);
RegCloseKey
(
key
);
}
}
else
{
WINE_TRACE
(
"Processing %s entries under HKCU.
\n
"
,
wine_dbgstr_w
(
keyname
)
);
if
(
!
RegCreateKeyExW
(
root
,
keypathW
,
0
,
NULL
,
0
,
KEY_READ
,
NULL
,
&
key
,
NULL
))
{
process_run_key
(
key
,
keyname
,
delete
,
synchronous
);
RegCloseKey
(
key
);
}
}
}
/*
...
...
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