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
0f01be47
Commit
0f01be47
authored
Mar 29, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start: Pass a valid filename argument to FormatMessage.
parent
bb0c660e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
start.c
programs/start/start.c
+9
-6
No files found.
programs/start/start.c
View file @
0f01be47
...
@@ -70,8 +70,9 @@ static void output(const WCHAR *message)
...
@@ -70,8 +70,9 @@ static void output(const WCHAR *message)
then terminate.
then terminate.
*/
*/
static
void
fatal_error
(
const
WCHAR
*
msg
,
DWORD
error_code
)
static
void
fatal_error
(
const
WCHAR
*
msg
,
DWORD
error_code
,
const
WCHAR
*
filename
)
{
{
DWORD_PTR
args
[
1
];
LPVOID
lpMsgBuf
;
LPVOID
lpMsgBuf
;
int
status
;
int
status
;
static
const
WCHAR
colonsW
[]
=
{
':'
,
' '
,
0
};
static
const
WCHAR
colonsW
[]
=
{
':'
,
' '
,
0
};
...
@@ -79,7 +80,9 @@ static void fatal_error(const WCHAR *msg, DWORD error_code)
...
@@ -79,7 +80,9 @@ static void fatal_error(const WCHAR *msg, DWORD error_code)
output
(
msg
);
output
(
msg
);
output
(
colonsW
);
output
(
colonsW
);
status
=
FormatMessageW
(
FORMAT_MESSAGE_ALLOCATE_BUFFER
|
FORMAT_MESSAGE_FROM_SYSTEM
,
NULL
,
error_code
,
0
,
(
LPWSTR
)
&
lpMsgBuf
,
0
,
NULL
);
args
[
0
]
=
(
DWORD_PTR
)
filename
;
status
=
FormatMessageW
(
FORMAT_MESSAGE_ALLOCATE_BUFFER
|
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_ARGUMENT_ARRAY
,
NULL
,
error_code
,
0
,
(
LPWSTR
)
&
lpMsgBuf
,
0
,
(
__ms_va_list
*
)
args
);
if
(
!
status
)
if
(
!
status
)
{
{
WINE_ERR
(
"FormatMessage failed
\n
"
);
WINE_ERR
(
"FormatMessage failed
\n
"
);
...
@@ -92,7 +95,7 @@ static void fatal_error(const WCHAR *msg, DWORD error_code)
...
@@ -92,7 +95,7 @@ static void fatal_error(const WCHAR *msg, DWORD error_code)
ExitProcess
(
1
);
ExitProcess
(
1
);
}
}
static
void
fatal_string_error
(
int
which
,
DWORD
error_code
)
static
void
fatal_string_error
(
int
which
,
DWORD
error_code
,
const
WCHAR
*
filename
)
{
{
WCHAR
msg
[
2048
];
WCHAR
msg
[
2048
];
...
@@ -100,7 +103,7 @@ static void fatal_string_error(int which, DWORD error_code)
...
@@ -100,7 +103,7 @@ static void fatal_string_error(int which, DWORD error_code)
msg
,
sizeof
(
msg
)
/
sizeof
(
WCHAR
)))
msg
,
sizeof
(
msg
)
/
sizeof
(
WCHAR
)))
WINE_ERR
(
"LoadString failed, error %d
\n
"
,
GetLastError
());
WINE_ERR
(
"LoadString failed, error %d
\n
"
,
GetLastError
());
fatal_error
(
msg
,
error_code
);
fatal_error
(
msg
,
error_code
,
filename
);
}
}
static
void
fatal_string
(
int
which
)
static
void
fatal_string
(
int
which
)
...
@@ -332,7 +335,7 @@ int wmain (int argc, WCHAR *argv[])
...
@@ -332,7 +335,7 @@ int wmain (int argc, WCHAR *argv[])
&
startup_info
,
/* lpStartupInfo */
&
startup_info
,
/* lpStartupInfo */
&
process_information
/* lpProcessInformation */
))
&
process_information
/* lpProcessInformation */
))
{
{
fatal_string_error
(
STRING_EXECFAIL
,
GetLastError
());
fatal_string_error
(
STRING_EXECFAIL
,
GetLastError
()
,
sei
.
lpFile
);
}
}
sei
.
hProcess
=
process_information
.
hProcess
;
sei
.
hProcess
=
process_information
.
hProcess
;
goto
done
;
goto
done
;
...
@@ -340,7 +343,7 @@ int wmain (int argc, WCHAR *argv[])
...
@@ -340,7 +343,7 @@ int wmain (int argc, WCHAR *argv[])
}
}
if
(
!
ShellExecuteExW
(
&
sei
))
if
(
!
ShellExecuteExW
(
&
sei
))
fatal_string_error
(
STRING_EXECFAIL
,
GetLastError
());
fatal_string_error
(
STRING_EXECFAIL
,
GetLastError
()
,
sei
.
lpFile
);
done:
done:
HeapFree
(
GetProcessHeap
(),
0
,
args
);
HeapFree
(
GetProcessHeap
(),
0
,
args
);
...
...
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