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
d6060b7c
Commit
d6060b7c
authored
Apr 03, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winecrt0: Add a fallback implementation of __wine_dbg_strdup().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c9bf5250
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
Makefile.in
dlls/winecrt0/Makefile.in
+1
-0
debug.c
dlls/winecrt0/debug.c
+62
-0
No files found.
dlls/winecrt0/Makefile.in
View file @
d6060b7c
MODULE
=
libwinecrt0.a
C_SRCS
=
\
debug.c
\
delay_load.c
\
dll_entry.c
\
dll_main.c
\
...
...
dlls/winecrt0/debug.c
0 → 100644
View file @
d6060b7c
/*
* Fallbacks for debugging functions when running on Windows
*
* Copyright 2019 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef _WIN32
#include "config.h"
#include "wine/port.h"
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
static
const
char
*
(
__cdecl
*
p__wine_dbg_strdup
)(
const
char
*
str
);
static
void
load_func
(
void
**
func
,
const
char
*
name
,
void
*
def
)
{
if
(
!*
func
)
{
HMODULE
module
=
GetModuleHandleA
(
"ntdll.dll"
);
void
*
proc
=
GetProcAddress
(
module
,
name
);
interlocked_xchg_ptr
(
func
,
proc
?
proc
:
def
);
}
}
#define LOAD_FUNC(name) load_func( (void **)&p ## name, #name, fallback ## name )
/* FIXME: this is not 100% thread-safe */
static
const
char
*
__cdecl
fallback__wine_dbg_strdup
(
const
char
*
str
)
{
static
char
*
list
[
32
];
static
int
pos
;
char
*
ret
=
_strdup
(
str
);
int
idx
;
idx
=
interlocked_xchg_add
(
&
pos
,
1
)
%
ARRAY_SIZE
(
list
);
free
(
interlocked_xchg_ptr
(
(
void
**
)
&
list
[
idx
],
ret
));
return
ret
;
}
const
char
*
__cdecl
__wine_dbg_strdup
(
const
char
*
str
)
{
LOAD_FUNC
(
__wine_dbg_strdup
);
return
p__wine_dbg_strdup
(
str
);
}
#endif
/* _WIN32 */
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