Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a76518c1
Commit
a76518c1
authored
Dec 11, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Use exception handlers instead of IsBad* functions.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f88404bf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
13 deletions
+49
-13
memory.c
dlls/kernelbase/memory.c
+14
-1
path.c
dlls/kernelbase/path.c
+18
-7
registry.c
dlls/kernelbase/registry.c
+10
-1
sync.c
dlls/kernelbase/sync.c
+7
-4
No files found.
dlls/kernelbase/memory.c
View file @
a76518c1
...
@@ -688,7 +688,20 @@ LPVOID WINAPI DECLSPEC_HOTPATCH LocalLock( HLOCAL hmem )
...
@@ -688,7 +688,20 @@ LPVOID WINAPI DECLSPEC_HOTPATCH LocalLock( HLOCAL hmem )
{
{
void
*
ret
=
NULL
;
void
*
ret
=
NULL
;
if
(
is_pointer
(
hmem
))
return
IsBadReadPtr
(
hmem
,
1
)
?
NULL
:
hmem
;
if
(
is_pointer
(
hmem
))
{
__TRY
{
volatile
char
*
p
=
hmem
;
*
p
|=
0
;
}
__EXCEPT_PAGE_FAULT
{
return
NULL
;
}
__ENDTRY
return
hmem
;
}
RtlLockHeap
(
GetProcessHeap
()
);
RtlLockHeap
(
GetProcessHeap
()
);
__TRY
__TRY
...
...
dlls/kernelbase/path.c
View file @
a76518c1
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include "winternl.h"
#include "winternl.h"
#include "kernelbase.h"
#include "kernelbase.h"
#include "wine/exception.h"
#include "wine/debug.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/heap.h"
...
@@ -5049,10 +5050,15 @@ HRESULT WINAPI HashData(const unsigned char *src, DWORD src_len, unsigned char *
...
@@ -5049,10 +5050,15 @@ HRESULT WINAPI HashData(const unsigned char *src, DWORD src_len, unsigned char *
HRESULT
WINAPI
UrlHashA
(
const
char
*
url
,
unsigned
char
*
dest
,
DWORD
dest_len
)
HRESULT
WINAPI
UrlHashA
(
const
char
*
url
,
unsigned
char
*
dest
,
DWORD
dest_len
)
{
{
if
(
IsBadStringPtrA
(
url
,
-
1
)
||
IsBadWritePtr
(
dest
,
dest_len
))
__TRY
{
HashData
((
const
BYTE
*
)
url
,
(
int
)
strlen
(
url
),
dest
,
dest_len
);
}
__EXCEPT_PAGE_FAULT
{
return
E_INVALIDARG
;
return
E_INVALIDARG
;
}
HashData
((
const
BYTE
*
)
url
,
(
int
)
strlen
(
url
),
dest
,
dest_len
);
__ENDTRY
return
S_OK
;
return
S_OK
;
}
}
...
@@ -5062,11 +5068,16 @@ HRESULT WINAPI UrlHashW(const WCHAR *url, unsigned char *dest, DWORD dest_len)
...
@@ -5062,11 +5068,16 @@ HRESULT WINAPI UrlHashW(const WCHAR *url, unsigned char *dest, DWORD dest_len)
TRACE
(
"%s, %p, %d
\n
"
,
debugstr_w
(
url
),
dest
,
dest_len
);
TRACE
(
"%s, %p, %d
\n
"
,
debugstr_w
(
url
),
dest
,
dest_len
);
if
(
IsBadStringPtrW
(
url
,
-
1
)
||
IsBadWritePtr
(
dest
,
dest_len
))
__TRY
{
WideCharToMultiByte
(
CP_ACP
,
0
,
url
,
-
1
,
urlA
,
MAX_PATH
,
NULL
,
NULL
);
HashData
((
const
BYTE
*
)
urlA
,
(
int
)
strlen
(
urlA
),
dest
,
dest_len
);
}
__EXCEPT_PAGE_FAULT
{
return
E_INVALIDARG
;
return
E_INVALIDARG
;
}
WideCharToMultiByte
(
CP_ACP
,
0
,
url
,
-
1
,
urlA
,
MAX_PATH
,
NULL
,
NULL
);
__ENDTRY
HashData
((
const
BYTE
*
)
urlA
,
(
int
)
strlen
(
urlA
),
dest
,
dest_len
);
return
S_OK
;
return
S_OK
;
}
}
...
...
dlls/kernelbase/registry.c
View file @
a76518c1
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
#include "kernelbase.h"
#include "kernelbase.h"
#include "wine/debug.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/heap.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "wine/list.h"
...
@@ -3432,8 +3433,16 @@ LONG WINAPI SHRegWriteUSValueW(HUSKEY hUSKey, const WCHAR *value, DWORD type, vo
...
@@ -3432,8 +3433,16 @@ LONG WINAPI SHRegWriteUSValueW(HUSKEY hUSKey, const WCHAR *value, DWORD type, vo
TRACE
(
"%p, %s, %d, %p, %d, %#x
\n
"
,
hUSKey
,
debugstr_w
(
value
),
type
,
data
,
data_len
,
flags
);
TRACE
(
"%p, %s, %d, %p, %d, %#x
\n
"
,
hUSKey
,
debugstr_w
(
value
),
type
,
data
,
data_len
,
flags
);
if
(
!
hUSKey
||
IsBadWritePtr
(
hUSKey
,
sizeof
(
struct
USKEY
))
||
!
(
flags
&
(
SHREGSET_FORCE_HKCU
|
SHREGSET_FORCE_HKLM
)))
__TRY
{
dummy
=
hKey
->
HKCUkey
||
hKey
->
HKLMkey
;
}
__EXCEPT_PAGE_FAULT
{
return
ERROR_INVALID_PARAMETER
;
return
ERROR_INVALID_PARAMETER
;
}
__ENDTRY
if
(
!
(
flags
&
(
SHREGSET_FORCE_HKCU
|
SHREGSET_FORCE_HKLM
)))
return
ERROR_INVALID_PARAMETER
;
if
(
flags
&
(
SHREGSET_FORCE_HKCU
|
SHREGSET_HKCU
))
if
(
flags
&
(
SHREGSET_FORCE_HKCU
|
SHREGSET_HKCU
))
{
{
...
...
dlls/kernelbase/sync.c
View file @
a76518c1
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include "kernelbase.h"
#include "kernelbase.h"
#include "wine/asm.h"
#include "wine/asm.h"
#include "wine/exception.h"
#include "wine/debug.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
sync
);
WINE_DEFAULT_DEBUG_CHANNEL
(
sync
);
...
@@ -336,14 +337,16 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventExW( SECURITY_ATTRIBUTES *sa, LPCWSTR
...
@@ -336,14 +337,16 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventExW( SECURITY_ATTRIBUTES *sa, LPCWSTR
/* one buggy program needs this
/* one buggy program needs this
* ("Van Dale Groot woordenboek der Nederlandse taal")
* ("Van Dale Groot woordenboek der Nederlandse taal")
*/
*/
if
(
sa
&&
IsBadReadPtr
(
sa
,
sizeof
(
SECURITY_ATTRIBUTES
)))
__TRY
{
get_create_object_attributes
(
&
attr
,
&
nameW
,
sa
,
name
);
}
__EXCEPT_PAGE_FAULT
{
{
ERR
(
"Bad security attributes pointer %p
\n
"
,
sa
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
return
0
;
}
}
__ENDTRY
get_create_object_attributes
(
&
attr
,
&
nameW
,
sa
,
name
);
status
=
NtCreateEvent
(
&
ret
,
access
,
&
attr
,
status
=
NtCreateEvent
(
&
ret
,
access
,
&
attr
,
(
flags
&
CREATE_EVENT_MANUAL_RESET
)
?
NotificationEvent
:
SynchronizationEvent
,
(
flags
&
CREATE_EVENT_MANUAL_RESET
)
?
NotificationEvent
:
SynchronizationEvent
,
...
...
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