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
f53abfce
Commit
f53abfce
authored
Nov 16, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Nov 19, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Dynamically allocate buffer for command parameters.
parent
6ec1eaf3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
6 deletions
+28
-6
shlexec.c
dlls/shell32/shlexec.c
+28
-6
No files found.
dlls/shell32/shlexec.c
View file @
f53abfce
...
...
@@ -1305,8 +1305,10 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
SEE_MASK_CONNECTNETDRV
|
SEE_MASK_FLAG_DDEWAIT
|
SEE_MASK_FLAG_NO_UI
|
SEE_MASK_UNICODE
|
SEE_MASK_ASYNCOK
|
SEE_MASK_HMONITOR
;
WCHAR
*
wszApplicationName
,
wszParameters
[
1024
],
wszDir
[
MAX_PATH
];
WCHAR
parametersBuffer
[
1024
];
WCHAR
*
wszApplicationName
,
*
wszParameters
,
wszDir
[
MAX_PATH
];
DWORD
dwApplicationNameLen
=
MAX_PATH
+
2
;
DWORD
parametersLen
=
sizeof
(
parametersBuffer
)
/
sizeof
(
WCHAR
);
DWORD
len
;
SHELLEXECUTEINFOW
sei_tmp
;
/* modifiable copy of SHELLEXECUTEINFO struct */
WCHAR
wfileName
[
MAX_PATH
];
...
...
@@ -1354,8 +1356,17 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
memcpy
(
wszApplicationName
,
sei_tmp
.
lpFile
,
l
*
sizeof
(
WCHAR
));
}
wszParameters
=
parametersBuffer
;
if
(
sei_tmp
.
lpParameters
)
{
len
=
lstrlenW
(
sei_tmp
.
lpParameters
)
+
1
;
if
(
len
>
parametersLen
)
{
wszParameters
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
parametersLen
=
len
;
}
strcpyW
(
wszParameters
,
sei_tmp
.
lpParameters
);
}
else
*
wszParameters
=
'\0'
;
...
...
@@ -1389,6 +1400,8 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
if
(
hr
==
S_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
wszApplicationName
);
if
(
wszParameters
!=
parametersBuffer
)
HeapFree
(
GetProcessHeap
(),
0
,
wszParameters
);
return
TRUE
;
}
}
...
...
@@ -1402,6 +1415,8 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
{
sei
->
hInstApp
=
(
HINSTANCE
)
33
;
HeapFree
(
GetProcessHeap
(),
0
,
wszApplicationName
);
if
(
wszParameters
!=
parametersBuffer
)
HeapFree
(
GetProcessHeap
(),
0
,
wszParameters
);
return
TRUE
;
}
...
...
@@ -1415,7 +1430,7 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
HCR_GetExecuteCommandW
((
cmask
==
SEE_MASK_CLASSKEY
)
?
sei_tmp
.
hkeyClass
:
NULL
,
(
cmask
==
SEE_MASK_CLASSNAME
)
?
sei_tmp
.
lpClass
:
NULL
,
sei_tmp
.
lpVerb
,
wszParameters
,
sizeof
(
wszParameters
)
/
sizeof
(
WCHAR
)
);
wszParameters
,
parametersLen
);
/* FIXME: get the extension of lpFile, check if it fits to the lpClass */
TRACE
(
"SEE_MASK_CLASSNAME->%s, doc->%s
\n
"
,
debugstr_w
(
wszParameters
),
debugstr_w
(
wszApplicationName
));
...
...
@@ -1432,6 +1447,8 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
retval
=
execfunc
(
wcmd
,
NULL
,
FALSE
,
&
sei_tmp
,
sei
);
HeapFree
(
GetProcessHeap
(),
0
,
wszApplicationName
);
if
(
wszParameters
!=
parametersBuffer
)
HeapFree
(
GetProcessHeap
(),
0
,
wszParameters
);
return
retval
>
32
;
}
...
...
@@ -1496,10 +1513,11 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
len
++
;
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
ExpandEnvironmentStringsW
(
sei_tmp
.
lpParameters
,
buf
,
len
);
if
(
len
>
1024
)
ERR
(
"Parameters exceeds buffer size (%i > 1024)
\n
"
,
len
);
lstrcpynW
(
wszParameters
,
buf
,
min
(
1024
,
len
));
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
if
(
wszParameters
!=
parametersBuffer
)
HeapFree
(
GetProcessHeap
(),
0
,
wszParameters
);
wszParameters
=
buf
;
parametersLen
=
len
;
sei_tmp
.
lpParameters
=
wszParameters
;
}
}
...
...
@@ -1595,6 +1613,8 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
retval
=
execfunc
(
wcmd
,
NULL
,
FALSE
,
&
sei_tmp
,
sei
);
if
(
retval
>
32
)
{
HeapFree
(
GetProcessHeap
(),
0
,
wszApplicationName
);
if
(
wszParameters
!=
parametersBuffer
)
HeapFree
(
GetProcessHeap
(),
0
,
wszParameters
);
return
TRUE
;
}
...
...
@@ -1664,6 +1684,8 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
TRACE
(
"retval %lu
\n
"
,
retval
);
HeapFree
(
GetProcessHeap
(),
0
,
wszApplicationName
);
if
(
wszParameters
!=
parametersBuffer
)
HeapFree
(
GetProcessHeap
(),
0
,
wszParameters
);
sei
->
hInstApp
=
(
HINSTANCE
)(
retval
>
32
?
33
:
retval
);
return
retval
>
32
;
...
...
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