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
12167d2e
Commit
12167d2e
authored
Aug 29, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Implement AddDllDirectory and RemoveDllDirectory.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
dfa1815c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
114 additions
and
10 deletions
+114
-10
api-ms-win-core-libraryloader-l1-1-0.spec
...ryloader-l1-1-0/api-ms-win-core-libraryloader-l1-1-0.spec
+2
-2
api-ms-win-core-libraryloader-l1-1-1.spec
...ryloader-l1-1-1/api-ms-win-core-libraryloader-l1-1-1.spec
+2
-2
api-ms-win-core-libraryloader-l1-2-0.spec
...ryloader-l1-2-0/api-ms-win-core-libraryloader-l1-2-0.spec
+2
-2
kernel32.spec
dlls/kernel32/kernel32.spec
+2
-2
module.c
dlls/kernel32/module.c
+54
-0
module.c
dlls/kernel32/tests/module.c
+50
-0
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+2
-2
No files found.
dlls/api-ms-win-core-libraryloader-l1-1-0/api-ms-win-core-libraryloader-l1-1-0.spec
View file @
12167d2e
@ st
ub
AddDllDirectory
@ st
dcall AddDllDirectory(wstr) kernel32.
AddDllDirectory
@ stdcall DisableThreadLibraryCalls(long) kernel32.DisableThreadLibraryCalls
@ stdcall EnumResourceLanguagesExA(long str str ptr long long long) kernel32.EnumResourceLanguagesExA
@ stdcall EnumResourceLanguagesExW(long wstr wstr ptr long long long) kernel32.EnumResourceLanguagesExW
...
...
@@ -24,6 +24,6 @@
@ stdcall LoadStringA(long long ptr long) user32.LoadStringA
@ stdcall LoadStringW(long long ptr long) user32.LoadStringW
@ stdcall LockResource(long) kernel32.LockResource
@ st
ub
RemoveDllDirectory
@ st
dcall RemoveDllDirectory(ptr) kernel32.
RemoveDllDirectory
@ stdcall SetDefaultDllDirectories(long) kernel32.SetDefaultDllDirectories
@ stdcall SizeofResource(long long) kernel32.SizeofResource
dlls/api-ms-win-core-libraryloader-l1-1-1/api-ms-win-core-libraryloader-l1-1-1.spec
View file @
12167d2e
@ st
ub
AddDllDirectory
@ st
dcall AddDllDirectory(wstr) kernel32.
AddDllDirectory
@ stdcall DisableThreadLibraryCalls(long) kernel32.DisableThreadLibraryCalls
@ stdcall EnumResourceLanguagesExA(long str str ptr long long long) kernel32.EnumResourceLanguagesExA
@ stdcall EnumResourceLanguagesExW(long wstr wstr ptr long long long) kernel32.EnumResourceLanguagesExW
...
...
@@ -25,6 +25,6 @@
@ stdcall LoadStringW(long long ptr long) user32.LoadStringW
@ stdcall LockResource(long) kernel32.LockResource
@ stub QueryOptionalDelayLoadedAPI
@ st
ub
RemoveDllDirectory
@ st
dcall RemoveDllDirectory(ptr) kernel32.
RemoveDllDirectory
@ stdcall SetDefaultDllDirectories(long) kernel32.SetDefaultDllDirectories
@ stdcall SizeofResource(long long) kernel32.SizeofResource
dlls/api-ms-win-core-libraryloader-l1-2-0/api-ms-win-core-libraryloader-l1-2-0.spec
View file @
12167d2e
@ st
ub
AddDllDirectory
@ st
dcall AddDllDirectory(wstr) kernel32.
AddDllDirectory
@ stdcall DisableThreadLibraryCalls(long) kernel32.DisableThreadLibraryCalls
@ stdcall EnumResourceLanguagesExA(long str str ptr long long long) kernel32.EnumResourceLanguagesExA
@ stdcall EnumResourceLanguagesExW(long wstr wstr ptr long long long) kernel32.EnumResourceLanguagesExW
...
...
@@ -24,6 +24,6 @@
@ stdcall LoadStringA(long long ptr long) user32.LoadStringA
@ stdcall LoadStringW(long long ptr long) user32.LoadStringW
@ stdcall LockResource(long) kernel32.LockResource
@ st
ub
RemoveDllDirectory
@ st
dcall RemoveDllDirectory(ptr) kernel32.
RemoveDllDirectory
@ stdcall SetDefaultDllDirectories(long) kernel32.SetDefaultDllDirectories
@ stdcall SizeofResource(long long) kernel32.SizeofResource
dlls/kernel32/kernel32.spec
View file @
12167d2e
...
...
@@ -140,7 +140,7 @@
@ stdcall AddAtomW(wstr)
@ stdcall AddConsoleAliasA(str str str)
@ stdcall AddConsoleAliasW(wstr wstr wstr)
# @ stub AddDllDirectory
@ stdcall AddDllDirectory(wstr)
# @ stub AddIntegrityLabelToBoundaryDescriptor
# @ stub AddLocalAlternateComputerNameA
# @ stub AddLocalAlternateComputerNameW
...
...
@@ -1274,7 +1274,7 @@
@ stub RequestDeviceWakeup
# @ stub RemoveDirectoryTransactedA
# @ stub RemoveDirectoryTransactedW
# @ stub RemoveDllDirectory
@ stdcall RemoveDllDirectory(ptr)
# @ stub RemoveSecureMemoryCacheCallback
# @ stub ReplacePartitionUnit
@ stdcall RequestWakeupLatency(long)
...
...
dlls/kernel32/module.c
View file @
12167d2e
...
...
@@ -40,6 +40,7 @@
#include "psapi.h"
#include "wine/exception.h"
#include "wine/list.h"
#include "wine/debug.h"
#include "wine/unicode.h"
...
...
@@ -47,6 +48,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(module);
#define NE_FFLAGS_LIBMODULE 0x8000
struct
dll_dir_entry
{
struct
list
entry
;
WCHAR
dir
[
1
];
};
static
struct
list
dll_dir_list
=
LIST_INIT
(
dll_dir_list
);
/* extra dirs from AddDllDirectory */
static
WCHAR
*
dll_directory
;
/* extra path for SetDllDirectoryW */
static
DWORD
default_search_flags
;
/* default flags set by SetDefaultDllDirectories */
...
...
@@ -153,6 +161,52 @@ BOOL WINAPI SetDllDirectoryW( LPCWSTR dir )
}
/****************************************************************************
* AddDllDirectory (KERNEL32.@)
*/
DLL_DIRECTORY_COOKIE
WINAPI
AddDllDirectory
(
const
WCHAR
*
dir
)
{
WCHAR
path
[
MAX_PATH
];
DWORD
len
;
struct
dll_dir_entry
*
ptr
;
DOS_PATHNAME_TYPE
type
=
RtlDetermineDosPathNameType_U
(
dir
);
if
(
type
!=
ABSOLUTE_PATH
&&
type
!=
ABSOLUTE_DRIVE_PATH
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
if
(
!
(
len
=
GetFullPathNameW
(
dir
,
MAX_PATH
,
path
,
NULL
)))
return
NULL
;
if
(
GetFileAttributesW
(
path
)
==
INVALID_FILE_ATTRIBUTES
)
return
NULL
;
if
(
!
(
ptr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
offsetof
(
struct
dll_dir_entry
,
dir
[
++
len
]
))))
return
NULL
;
memcpy
(
ptr
->
dir
,
path
,
len
*
sizeof
(
WCHAR
)
);
TRACE
(
"%s
\n
"
,
debugstr_w
(
ptr
->
dir
));
RtlEnterCriticalSection
(
&
dlldir_section
);
list_add_head
(
&
dll_dir_list
,
&
ptr
->
entry
);
RtlLeaveCriticalSection
(
&
dlldir_section
);
return
ptr
;
}
/****************************************************************************
* RemoveDllDirectory (KERNEL32.@)
*/
BOOL
WINAPI
RemoveDllDirectory
(
DLL_DIRECTORY_COOKIE
cookie
)
{
struct
dll_dir_entry
*
ptr
=
cookie
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
ptr
->
dir
));
RtlEnterCriticalSection
(
&
dlldir_section
);
list_remove
(
&
ptr
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
ptr
);
RtlLeaveCriticalSection
(
&
dlldir_section
);
return
TRUE
;
}
/*************************************************************************
* SetDefaultDllDirectories (KERNEL32.@)
*/
...
...
dlls/kernel32/tests/module.c
View file @
12167d2e
...
...
@@ -25,6 +25,8 @@
static
DWORD
(
WINAPI
*
pGetDllDirectoryA
)(
DWORD
,
LPSTR
);
static
DWORD
(
WINAPI
*
pGetDllDirectoryW
)(
DWORD
,
LPWSTR
);
static
BOOL
(
WINAPI
*
pSetDllDirectoryA
)(
LPCSTR
);
static
DLL_DIRECTORY_COOKIE
(
WINAPI
*
pAddDllDirectory
)(
const
WCHAR
*
);
static
BOOL
(
WINAPI
*
pRemoveDllDirectory
)(
DLL_DIRECTORY_COOKIE
);
static
BOOL
(
WINAPI
*
pSetDefaultDllDirectories
)(
DWORD
);
static
BOOL
(
WINAPI
*
pGetModuleHandleExA
)(
DWORD
,
LPCSTR
,
HMODULE
*
);
static
BOOL
(
WINAPI
*
pGetModuleHandleExW
)(
DWORD
,
LPCWSTR
,
HMODULE
*
);
...
...
@@ -516,6 +518,8 @@ static void init_pointers(void)
MAKEFUNC
(
GetDllDirectoryA
);
MAKEFUNC
(
GetDllDirectoryW
);
MAKEFUNC
(
SetDllDirectoryA
);
MAKEFUNC
(
AddDllDirectory
);
MAKEFUNC
(
RemoveDllDirectory
);
MAKEFUNC
(
SetDefaultDllDirectories
);
MAKEFUNC
(
GetModuleHandleExA
);
MAKEFUNC
(
GetModuleHandleExW
);
...
...
@@ -741,6 +745,51 @@ static void testK32GetModuleInformation(void)
ok
(
info
.
EntryPoint
!=
NULL
,
"Expected nonzero entrypoint
\n
"
);
}
static
void
test_AddDllDirectory
(
void
)
{
static
const
WCHAR
tmpW
[]
=
{
't'
,
'm'
,
'p'
,
0
};
static
const
WCHAR
dotW
[]
=
{
'.'
,
'\\'
,
'.'
,
0
};
static
const
WCHAR
rootW
[]
=
{
'\\'
,
0
};
WCHAR
path
[
MAX_PATH
],
buf
[
MAX_PATH
];
DLL_DIRECTORY_COOKIE
cookie
;
BOOL
ret
;
if
(
!
pAddDllDirectory
||
!
pRemoveDllDirectory
)
{
win_skip
(
"AddDllDirectory not available
\n
"
);
return
;
}
buf
[
0
]
=
'\0'
;
GetTempPathW
(
sizeof
(
path
),
path
);
GetTempFileNameW
(
path
,
tmpW
,
0
,
buf
);
SetLastError
(
0xdeadbeef
);
cookie
=
pAddDllDirectory
(
buf
);
ok
(
cookie
!=
NULL
,
"AddDllDirectory failed err %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
pRemoveDllDirectory
(
cookie
);
ok
(
ret
,
"RemoveDllDirectory failed err %u
\n
"
,
GetLastError
()
);
DeleteFileW
(
buf
);
SetLastError
(
0xdeadbeef
);
cookie
=
pAddDllDirectory
(
buf
);
ok
(
!
cookie
,
"AddDllDirectory succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"wrong error %u
\n
"
,
GetLastError
()
);
cookie
=
pAddDllDirectory
(
dotW
);
ok
(
!
cookie
,
"AddDllDirectory succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
cookie
=
pAddDllDirectory
(
rootW
);
ok
(
cookie
!=
NULL
,
"AddDllDirectory failed err %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
pRemoveDllDirectory
(
cookie
);
ok
(
ret
,
"RemoveDllDirectory failed err %u
\n
"
,
GetLastError
()
);
GetWindowsDirectoryW
(
buf
,
MAX_PATH
);
lstrcpyW
(
buf
+
2
,
tmpW
);
cookie
=
pAddDllDirectory
(
buf
);
ok
(
!
cookie
,
"AddDllDirectory succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
}
static
void
test_SetDefaultDllDirectories
(
void
)
{
HMODULE
mod
;
...
...
@@ -834,5 +883,6 @@ START_TEST(module)
testLoadLibraryEx
();
testGetModuleHandleEx
();
testK32GetModuleInformation
();
test_AddDllDirectory
();
test_SetDefaultDllDirectories
();
}
dlls/kernelbase/kernelbase.spec
View file @
12167d2e
...
...
@@ -19,7 +19,7 @@
@ stdcall AddAuditAccessAce(ptr long long ptr long long) advapi32.AddAuditAccessAce
@ stdcall AddAuditAccessAceEx(ptr long long long ptr long long) advapi32.AddAuditAccessAceEx
@ stdcall AddAuditAccessObjectAce(ptr long long long ptr ptr ptr long long) advapi32.AddAuditAccessObjectAce
@ st
ub
AddDllDirectory
@ st
dcall AddDllDirectory(wstr) kernel32.
AddDllDirectory
@ stdcall AddMandatoryAce(ptr long long long ptr) advapi32.AddMandatoryAce
@ stdcall AddRefActCtx(ptr) kernel32.AddRefActCtx
# @ stub AddResourceAttributeAce
...
...
@@ -1333,7 +1333,7 @@
# @ stub RemapPredefinedHandleInternal
@ stdcall RemoveDirectoryA(str) kernel32.RemoveDirectoryA
@ stdcall RemoveDirectoryW(wstr) kernel32.RemoveDirectoryW
@ st
ub
RemoveDllDirectory
@ st
dcall RemoveDllDirectory(ptr) kernel32.
RemoveDllDirectory
# @ stub RemovePackageStatus
# @ stub RemovePackageStatusForUser
@ stdcall RemoveVectoredContinueHandler(ptr) kernel32.RemoveVectoredContinueHandler
...
...
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