Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
b517b764
Commit
b517b764
authored
23 years ago
by
Francois Gouget
Committed by
Alexandre Julliard
23 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Expand environment variables in "Debugger" setting.
Replace fixed-size buffers with dynamic ones.
parent
3ae80eb2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
win32/except.c
+46
-19
46 additions, 19 deletions
win32/except.c
with
46 additions
and
19 deletions
win32/except.c
+
46
−
19
View file @
b517b764
...
...
@@ -197,8 +197,10 @@ static BOOL start_debugger(PEXCEPTION_POINTERS epointers, HANDLE hEvent)
DWORD
bAuto
=
FALSE
;
PROCESS_INFORMATION
info
;
STARTUPINFOA
startup
;
char
buffer
[
256
];
char
format
[
256
];
char
*
cmdline
=
NULL
;
char
*
format
=
NULL
;
DWORD
format_size
;
BOOL
ret
=
FALSE
;
MESSAGE
(
"wine: Unhandled exception, starting debugger...
\n
"
);
...
...
@@ -207,9 +209,21 @@ static BOOL start_debugger(PEXCEPTION_POINTERS epointers, HANDLE hEvent)
DWORD
type
;
DWORD
count
;
count
=
sizeof
(
format
);
if
(
RegQueryValueExA
(
hDbgConf
,
"Debugger"
,
0
,
&
type
,
format
,
&
count
))
format
[
0
]
=
0
;
format_size
=
0
;
if
(
!
RegQueryValueExA
(
hDbgConf
,
"Debugger"
,
0
,
&
type
,
NULL
,
&
format_size
))
{
format
=
HeapAlloc
(
GetProcessHeap
(),
0
,
format_size
);
RegQueryValueExA
(
hDbgConf
,
"Debugger"
,
0
,
&
type
,
format
,
&
format_size
);
if
(
type
==
REG_EXPAND_SZ
)
{
char
*
tmp
;
/* Expand environment variable references */
format_size
=
ExpandEnvironmentStringsA
(
format
,
NULL
,
0
);
tmp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
format_size
);
ExpandEnvironmentStringsA
(
format
,
tmp
,
format_size
);
HeapFree
(
GetProcessHeap
(),
0
,
format
);
format
=
tmp
;
}
}
count
=
sizeof
(
bAuto
);
if
(
RegQueryValueExA
(
hDbgConf
,
"Auto"
,
0
,
&
type
,
(
char
*
)
&
bAuto
,
&
count
))
...
...
@@ -224,7 +238,7 @@ static BOOL start_debugger(PEXCEPTION_POINTERS epointers, HANDLE hEvent)
RegCloseKey
(
hDbgConf
);
}
else
{
/* try a default setup... */
strcpy
(
format
,
"
debugger/winedbg
%ld %ld"
);
strcpy
(
format
,
"
winedbg --debugmsg -all -- --auto
%ld %ld"
);
}
if
(
!
bAuto
)
...
...
@@ -235,30 +249,43 @@ static BOOL start_debugger(PEXCEPTION_POINTERS epointers, HANDLE hEvent)
if
(
mod
)
pMessageBoxA
=
(
MessageBoxA_funcptr
)
GetProcAddress
(
mod
,
"MessageBoxA"
);
if
(
pMessageBoxA
)
{
char
buffer
[
256
];
format_exception_msg
(
epointers
,
buffer
,
sizeof
(
buffer
)
);
if
(
pMessageBoxA
(
0
,
buffer
,
"Exception raised"
,
MB_YESNO
|
MB_ICONHAND
)
==
IDNO
)
{
TRACE
(
"Killing process
\n
"
);
return
FALSE
;
goto
EXIT
;
}
}
}
TRACE
(
"Starting debugger (fmt=%s)
\n
"
,
format
);
sprintf
(
buffer
,
format
,
GetCurrentProcessId
(),
hEvent
);
memset
(
&
startup
,
0
,
sizeof
(
startup
));
startup
.
cb
=
sizeof
(
startup
);
startup
.
dwFlags
=
STARTF_USESHOWWINDOW
;
startup
.
wShowWindow
=
SW_SHOWNORMAL
;
if
(
CreateProcessA
(
NULL
,
buffer
,
NULL
,
NULL
,
TRUE
,
0
,
NULL
,
NULL
,
&
startup
,
&
info
))
{
/* wait for debugger to come up... */
WaitForSingleObject
(
hEvent
,
INFINITE
);
return
TRUE
;
if
(
format
)
{
TRACE
(
"Starting debugger (fmt=%s)
\n
"
,
format
);
cmdline
=
HeapAlloc
(
GetProcessHeap
(),
0
,
format_size
+
2
*
20
);
sprintf
(
cmdline
,
format
,
GetCurrentProcessId
(),
hEvent
);
memset
(
&
startup
,
0
,
sizeof
(
startup
));
startup
.
cb
=
sizeof
(
startup
);
startup
.
dwFlags
=
STARTF_USESHOWWINDOW
;
startup
.
wShowWindow
=
SW_SHOWNORMAL
;
if
(
CreateProcessA
(
NULL
,
cmdline
,
NULL
,
NULL
,
TRUE
,
0
,
NULL
,
NULL
,
&
startup
,
&
info
))
{
/* wait for debugger to come up... */
WaitForSingleObject
(
hEvent
,
INFINITE
);
ret
=
TRUE
;
goto
EXIT
;
}
}
else
{
cmdline
=
NULL
;
}
ERR
(
"Couldn't start debugger (%s) (%ld)
\n
"
"Read the Wine Developers Guide on how to set up winedbg or another debugger
\n
"
,
buffer
,
GetLastError
());
return
FALSE
;
debugstr_a
(
cmdline
),
GetLastError
());
EXIT:
if
(
cmdline
)
HeapFree
(
GetProcessHeap
(),
0
,
cmdline
);
if
(
format
)
HeapFree
(
GetProcessHeap
(),
0
,
format
);
return
ret
;
}
/******************************************************************
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment