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
dab980e0
Commit
dab980e0
authored
Aug 02, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented Get/SetDllDirectory.
parent
3e00dec8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
123 additions
and
10 deletions
+123
-10
kernel32.spec
dlls/kernel/kernel32.spec
+4
-4
module.c
dlls/kernel/module.c
+119
-6
No files found.
dlls/kernel/kernel32.spec
View file @
dab980e0
...
...
@@ -508,8 +508,8 @@
@ stdcall GetDiskFreeSpaceExA (str ptr ptr ptr)
@ stdcall GetDiskFreeSpaceExW (wstr ptr ptr ptr)
@ stdcall GetDiskFreeSpaceW(wstr ptr ptr ptr ptr)
# @ stub GetDllDirectoryA
# @ stub GetDllDirectoryW
@ stdcall GetDllDirectoryA(long ptr)
@ stdcall GetDllDirectoryW(long ptr)
@ stdcall GetDriveTypeA(str)
@ stdcall GetDriveTypeW(wstr)
@ stdcall GetEnvironmentStrings() GetEnvironmentStringsA
...
...
@@ -996,8 +996,8 @@
@ stub SetDaylightFlag
@ stdcall SetDefaultCommConfigA(str ptr long)
@ stdcall SetDefaultCommConfigW(wstr ptr long)
# @ stub SetDllDirectoryA
# @ stub SetDllDirectoryW
@ stdcall SetDllDirectoryA(str)
@ stdcall SetDllDirectoryW(wstr)
@ stdcall SetEndOfFile(long)
@ stdcall SetEnvironmentVariableA(str str)
@ stdcall SetEnvironmentVariableW(wstr wstr)
...
...
dlls/kernel/module.c
View file @
dab980e0
...
...
@@ -47,6 +47,107 @@ WINE_DEFAULT_DEBUG_CHANNEL(module);
WINE_DECLARE_DEBUG_CHANNEL
(
loaddll
);
static
WCHAR
*
dll_directory
;
/* extra path for SetDllDirectoryW */
static
CRITICAL_SECTION
dlldir_section
;
static
CRITICAL_SECTION_DEBUG
critsect_debug
=
{
0
,
0
,
&
dlldir_section
,
{
&
critsect_debug
.
ProcessLocksList
,
&
critsect_debug
.
ProcessLocksList
},
0
,
0
,
{
0
,
(
DWORD
)(
__FILE__
": dlldir_section"
)
}
};
static
CRITICAL_SECTION
dlldir_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
/****************************************************************************
* GetDllDirectoryA (KERNEL32.@)
*/
DWORD
WINAPI
GetDllDirectoryA
(
DWORD
buf_len
,
LPSTR
buffer
)
{
DWORD
len
;
RtlEnterCriticalSection
(
&
dlldir_section
);
len
=
dll_directory
?
FILE_name_WtoA
(
dll_directory
,
strlenW
(
dll_directory
),
NULL
,
0
)
:
0
;
if
(
buffer
&&
buf_len
>
len
)
{
if
(
dll_directory
)
FILE_name_WtoA
(
dll_directory
,
-
1
,
buffer
,
buf_len
);
else
*
buffer
=
0
;
}
else
{
len
++
;
/* for terminating null */
if
(
buffer
)
*
buffer
=
0
;
}
RtlLeaveCriticalSection
(
&
dlldir_section
);
return
len
;
}
/****************************************************************************
* GetDllDirectoryW (KERNEL32.@)
*/
DWORD
WINAPI
GetDllDirectoryW
(
DWORD
buf_len
,
LPWSTR
buffer
)
{
DWORD
len
;
RtlEnterCriticalSection
(
&
dlldir_section
);
len
=
dll_directory
?
strlenW
(
dll_directory
)
:
0
;
if
(
buffer
&&
buf_len
>
len
)
{
if
(
dll_directory
)
memcpy
(
buffer
,
dll_directory
,
(
len
+
1
)
*
sizeof
(
WCHAR
)
);
else
*
buffer
=
0
;
}
else
{
len
++
;
/* for terminating null */
if
(
buffer
)
*
buffer
=
0
;
}
RtlLeaveCriticalSection
(
&
dlldir_section
);
return
len
;
}
/****************************************************************************
* SetDllDirectoryA (KERNEL32.@)
*/
BOOL
WINAPI
SetDllDirectoryA
(
LPCSTR
dir
)
{
WCHAR
*
dirW
;
BOOL
ret
;
if
(
!
(
dirW
=
FILE_name_AtoW
(
dir
,
TRUE
)))
return
FALSE
;
ret
=
SetDllDirectoryW
(
dirW
);
HeapFree
(
GetProcessHeap
(),
0
,
dirW
);
return
ret
;
}
/****************************************************************************
* SetDllDirectoryW (KERNEL32.@)
*/
BOOL
WINAPI
SetDllDirectoryW
(
LPCWSTR
dir
)
{
WCHAR
*
newdir
=
NULL
;
if
(
dir
)
{
DWORD
len
=
(
strlenW
(
dir
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
!
(
newdir
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)))
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
FALSE
;
}
memcpy
(
newdir
,
dir
,
len
);
}
RtlEnterCriticalSection
(
&
dlldir_section
);
HeapFree
(
GetProcessHeap
(),
0
,
dll_directory
);
dll_directory
=
newdir
;
RtlLeaveCriticalSection
(
&
dlldir_section
);
return
TRUE
;
}
/****************************************************************************
* DisableThreadLibraryCalls (KERNEL32.@)
*
...
...
@@ -570,14 +671,26 @@ WCHAR *MODULE_get_dll_load_path( LPCWSTR module )
if
(
RtlQueryEnvironmentVariable_U
(
NULL
,
&
name
,
&
value
)
==
STATUS_BUFFER_TOO_SMALL
)
path_len
=
value
.
Length
;
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
path_len
+
len
*
sizeof
(
WCHAR
)
)))
return
NULL
;
p
=
ret
;
if
(
module
)
RtlEnterCriticalSection
(
&
dlldir_section
)
;
if
(
dll_directory
)
len
+=
strlenW
(
dll_directory
)
+
1
;
if
(
(
p
=
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
path_len
+
len
*
sizeof
(
WCHAR
)
))
)
{
memcpy
(
ret
,
module
,
(
mod_end
-
module
)
*
sizeof
(
WCHAR
)
);
p
+=
(
mod_end
-
module
);
*
p
++
=
';'
;
if
(
module
)
{
memcpy
(
ret
,
module
,
(
mod_end
-
module
)
*
sizeof
(
WCHAR
)
);
p
+=
(
mod_end
-
module
);
*
p
++
=
';'
;
}
if
(
dll_directory
)
{
strcpyW
(
p
,
dll_directory
);
p
+=
strlenW
(
p
);
*
p
++
=
';'
;
}
}
RtlLeaveCriticalSection
(
&
dlldir_section
);
if
(
!
ret
)
return
NULL
;
strcpyW
(
p
,
system_path
);
p
+=
strlenW
(
p
);
*
p
++
=
';'
;
...
...
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