Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doxverilog
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
doxverilog
Commits
509359b6
Commit
509359b6
authored
Aug 01, 2013
by
Dimitri van Heesch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 705217 - Can't use unicode characters to execute external commands
parent
27fbe8df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
portable.cpp
src/portable.cpp
+10
-6
No files found.
src/portable.cpp
View file @
509359b6
...
@@ -30,7 +30,7 @@ extern char **environ;
...
@@ -30,7 +30,7 @@ extern char **environ;
static
double
g_sysElapsedTime
;
static
double
g_sysElapsedTime
;
static
QTime
g_time
;
static
QTime
g_time
;
int
portable_system
(
const
char
*
command
,
const
char
*
args
,
bool
commandHasConsole
)
int
portable_system
(
const
char
*
command
,
const
char
*
args
,
bool
commandHasConsole
)
{
{
if
(
command
==
0
)
return
1
;
if
(
command
==
0
)
return
1
;
...
@@ -130,20 +130,23 @@ int portable_system(const char *command,const char *args,bool commandHasConsole
...
@@ -130,20 +130,23 @@ int portable_system(const char *command,const char *args,bool commandHasConsole
// For that case COM is initialized as follows
// For that case COM is initialized as follows
CoInitializeEx
(
NULL
,
COINIT_APARTMENTTHREADED
|
COINIT_DISABLE_OLE1DDE
);
CoInitializeEx
(
NULL
,
COINIT_APARTMENTTHREADED
|
COINIT_DISABLE_OLE1DDE
);
QString
commandw
=
QString
::
fromUtf8
(
command
);
QString
argsw
=
QString
::
fromUtf8
(
args
);
// gswin32 is a GUI api which will pop up a window and run
// gswin32 is a GUI api which will pop up a window and run
// asynchronously. To prevent both, we use ShellExecuteEx and
// asynchronously. To prevent both, we use ShellExecuteEx and
// WaitForSingleObject (thanks to Robert Golias for the code)
// WaitForSingleObject (thanks to Robert Golias for the code)
SHELLEXECUTEINFO
sInfo
=
{
SHELLEXECUTEINFO
W
sInfo
=
{
sizeof
(
SHELLEXECUTEINFO
),
/* structure size */
sizeof
(
SHELLEXECUTEINFO
W
),
/* structure size */
SEE_MASK_NOCLOSEPROCESS
|
SEE_MASK_FLAG_NO_UI
,
/* tell us the process
SEE_MASK_NOCLOSEPROCESS
|
SEE_MASK_FLAG_NO_UI
,
/* tell us the process
* handle so we can wait till it's done |
* handle so we can wait till it's done |
* do not display msg box if error
* do not display msg box if error
*/
*/
NULL
,
/* window handle */
NULL
,
/* window handle */
NULL
,
/* action to perform: open */
NULL
,
/* action to perform: open */
command
,
/* file to execute */
(
LPCWSTR
)
commandw
.
ucs2
(),
/* file to execute */
args
,
/* argument list */
(
LPCWSTR
)
argsw
.
ucs2
(),
/* argument list */
NULL
,
/* use current working dir */
NULL
,
/* use current working dir */
SW_HIDE
,
/* minimize on start-up */
SW_HIDE
,
/* minimize on start-up */
0
,
/* application instance handle */
0
,
/* application instance handle */
...
@@ -154,7 +157,8 @@ int portable_system(const char *command,const char *args,bool commandHasConsole
...
@@ -154,7 +157,8 @@ int portable_system(const char *command,const char *args,bool commandHasConsole
NULL
,
/* ignored: icon */
NULL
,
/* ignored: icon */
NULL
/* resulting application handle */
NULL
/* resulting application handle */
};
};
if
(
!
ShellExecuteEx
(
&
sInfo
))
if
(
!
ShellExecuteExW
(
&
sInfo
))
{
{
return
-
1
;
return
-
1
;
}
}
...
...
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