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
f6b2aa4a
Commit
f6b2aa4a
authored
Oct 15, 2013
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Compile with -D__WINESRC__.
parent
08422163
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
131 additions
and
126 deletions
+131
-126
Makefile.in
dlls/advapi32/tests/Makefile.in
+0
-1
cred.c
dlls/advapi32/tests/cred.c
+14
-13
crypt.c
dlls/advapi32/tests/crypt.c
+20
-20
eventlog.c
dlls/advapi32/tests/eventlog.c
+5
-5
lsa.c
dlls/advapi32/tests/lsa.c
+1
-1
registry.c
dlls/advapi32/tests/registry.c
+23
-18
security.c
dlls/advapi32/tests/security.c
+59
-59
service.c
dlls/advapi32/tests/service.c
+9
-9
No files found.
dlls/advapi32/tests/Makefile.in
View file @
f6b2aa4a
TESTDLL
=
advapi32.dll
IMPORTS
=
ole32 advapi32
EXTRADEFS
=
-U__WINESRC__
-DWINE_STRICT_PROTOTYPES
-DWINE_NO_NAMELESS_EXTENSION
-DWIDL_C_INLINE_WRAPPERS
C_SRCS
=
\
cred.c
\
...
...
dlls/advapi32/tests/cred.c
View file @
f6b2aa4a
...
...
@@ -187,7 +187,7 @@ static void test_CredReadDomainCredentialsA(void)
char
target_name
[]
=
"no_such_target"
;
CREDENTIAL_TARGET_INFORMATIONA
info
=
{
target_name
,
NULL
,
target_name
,
NULL
,
NULL
,
NULL
,
NULL
,
0
,
0
,
NULL
};
DWORD
count
;
PCREDENTIAL
*
creds
;
PCREDENTIAL
A
*
creds
;
if
(
!
pCredReadDomainCredentialsA
)
{
...
...
@@ -744,18 +744,19 @@ static void test_CredIsMarshaledCredentialA(void)
START_TEST
(
cred
)
{
DWORD
persists
[
CRED_TYPE_MAXIMUM
];
pCredEnumerateA
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"advapi32.dll"
),
"CredEnumerateA"
);
pCredFree
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"advapi32.dll"
),
"CredFree"
);
pCredGetSessionTypes
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"advapi32.dll"
),
"CredGetSessionTypes"
);
pCredWriteA
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"advapi32.dll"
),
"CredWriteA"
);
pCredDeleteA
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"advapi32.dll"
),
"CredDeleteA"
);
pCredReadA
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"advapi32.dll"
),
"CredReadA"
);
pCredRenameA
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"advapi32.dll"
),
"CredRenameA"
);
pCredReadDomainCredentialsA
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"advapi32.dll"
),
"CredReadDomainCredentialsA"
);
pCredMarshalCredentialA
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"advapi32.dll"
),
"CredMarshalCredentialA"
);
pCredUnmarshalCredentialA
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"advapi32.dll"
),
"CredUnmarshalCredentialA"
);
pCredIsMarshaledCredentialA
=
(
void
*
)
GetProcAddress
(
GetModuleHandle
(
"advapi32.dll"
),
"CredIsMarshaledCredentialA"
);
HMODULE
mod
=
GetModuleHandleA
(
"advapi32.dll"
);
pCredEnumerateA
=
(
void
*
)
GetProcAddress
(
mod
,
"CredEnumerateA"
);
pCredFree
=
(
void
*
)
GetProcAddress
(
mod
,
"CredFree"
);
pCredGetSessionTypes
=
(
void
*
)
GetProcAddress
(
mod
,
"CredGetSessionTypes"
);
pCredWriteA
=
(
void
*
)
GetProcAddress
(
mod
,
"CredWriteA"
);
pCredDeleteA
=
(
void
*
)
GetProcAddress
(
mod
,
"CredDeleteA"
);
pCredReadA
=
(
void
*
)
GetProcAddress
(
mod
,
"CredReadA"
);
pCredRenameA
=
(
void
*
)
GetProcAddress
(
mod
,
"CredRenameA"
);
pCredReadDomainCredentialsA
=
(
void
*
)
GetProcAddress
(
mod
,
"CredReadDomainCredentialsA"
);
pCredMarshalCredentialA
=
(
void
*
)
GetProcAddress
(
mod
,
"CredMarshalCredentialA"
);
pCredUnmarshalCredentialA
=
(
void
*
)
GetProcAddress
(
mod
,
"CredUnmarshalCredentialA"
);
pCredIsMarshaledCredentialA
=
(
void
*
)
GetProcAddress
(
mod
,
"CredIsMarshaledCredentialA"
);
if
(
!
pCredEnumerateA
||
!
pCredFree
||
!
pCredWriteA
||
!
pCredDeleteA
||
!
pCredReadA
)
{
...
...
dlls/advapi32/tests/crypt.c
View file @
f6b2aa4a
...
...
@@ -474,21 +474,21 @@ static BOOL FindProvRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszProvNam
HKEY
subkey
;
DWORD
size
=
sizeof
(
DWORD
);
if
(
RegOpenKey
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Cryptography
\\
Defaults
\\
Provider"
,
&
hKey
))
if
(
RegOpenKey
A
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Cryptography
\\
Defaults
\\
Provider"
,
&
hKey
))
return
FALSE
;
RegQueryInfoKey
(
hKey
,
NULL
,
NULL
,
NULL
,
pdwProvCount
,
pcbProvName
,
RegQueryInfoKey
A
(
hKey
,
NULL
,
NULL
,
NULL
,
pdwProvCount
,
pcbProvName
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
(
*
pcbProvName
)
++
;
if
(
!
(
*
pszProvName
=
LocalAlloc
(
LMEM_ZEROINIT
,
*
pcbProvName
)))
return
FALSE
;
RegEnumKeyEx
(
hKey
,
dwIndex
,
*
pszProvName
,
pcbProvName
,
NULL
,
NULL
,
NULL
,
NULL
);
RegEnumKeyEx
A
(
hKey
,
dwIndex
,
*
pszProvName
,
pcbProvName
,
NULL
,
NULL
,
NULL
,
NULL
);
(
*
pcbProvName
)
++
;
RegOpenKey
(
hKey
,
*
pszProvName
,
&
subkey
);
RegQueryValueEx
(
subkey
,
"Type"
,
NULL
,
NULL
,
(
LPBYTE
)
pdwProvType
,
&
size
);
RegOpenKey
A
(
hKey
,
*
pszProvName
,
&
subkey
);
RegQueryValueEx
A
(
subkey
,
"Type"
,
NULL
,
NULL
,
(
LPBYTE
)
pdwProvType
,
&
size
);
RegCloseKey
(
subkey
);
RegCloseKey
(
hKey
);
...
...
@@ -599,10 +599,10 @@ static BOOL FindProvTypesRegVals(DWORD *pdwIndex, DWORD *pdwProvType, LPSTR *psz
DWORD
cbName
;
BOOL
ret
=
FALSE
;
if
(
RegOpenKey
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Cryptography
\\
Defaults
\\
Provider Types"
,
&
hKey
))
if
(
RegOpenKey
A
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Cryptography
\\
Defaults
\\
Provider Types"
,
&
hKey
))
return
FALSE
;
if
(
RegQueryInfoKey
(
hKey
,
NULL
,
NULL
,
NULL
,
pdwTypeCount
,
&
cbName
,
NULL
,
if
(
RegQueryInfoKey
A
(
hKey
,
NULL
,
NULL
,
NULL
,
pdwTypeCount
,
&
cbName
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
))
goto
cleanup
;
cbName
++
;
...
...
@@ -610,7 +610,7 @@ static BOOL FindProvTypesRegVals(DWORD *pdwIndex, DWORD *pdwProvType, LPSTR *psz
if
(
!
(
szName
=
LocalAlloc
(
LMEM_ZEROINIT
,
cbName
)))
goto
cleanup
;
while
(
!
RegEnumKeyEx
(
hKey
,
*
pdwIndex
,
szName
,
&
cbName
,
NULL
,
NULL
,
NULL
,
NULL
))
while
(
!
RegEnumKeyEx
A
(
hKey
,
*
pdwIndex
,
szName
,
&
cbName
,
NULL
,
NULL
,
NULL
,
NULL
))
{
cbName
++
;
ch
=
szName
+
strlen
(
szName
);
...
...
@@ -619,15 +619,15 @@ static BOOL FindProvTypesRegVals(DWORD *pdwIndex, DWORD *pdwProvType, LPSTR *psz
*
pdwProvType
+=
(
*
(
--
ch
)
-
'0'
)
*
10
;
*
pdwProvType
+=
(
*
(
--
ch
)
-
'0'
)
*
100
;
if
(
RegOpenKey
(
hKey
,
szName
,
&
hSubKey
))
if
(
RegOpenKey
A
(
hKey
,
szName
,
&
hSubKey
))
break
;
if
(
!
RegQueryValueEx
(
hSubKey
,
"TypeName"
,
NULL
,
NULL
,
NULL
,
pcbTypeName
))
if
(
!
RegQueryValueEx
A
(
hSubKey
,
"TypeName"
,
NULL
,
NULL
,
NULL
,
pcbTypeName
))
{
if
(
!
(
*
pszTypeName
=
LocalAlloc
(
LMEM_ZEROINIT
,
*
pcbTypeName
)))
break
;
if
(
!
RegQueryValueEx
(
hSubKey
,
"TypeName"
,
NULL
,
NULL
,
(
LPBYTE
)
*
pszTypeName
,
pcbTypeName
))
if
(
!
RegQueryValueEx
A
(
hSubKey
,
"TypeName"
,
NULL
,
NULL
,
(
LPBYTE
)
*
pszTypeName
,
pcbTypeName
))
{
ret
=
TRUE
;
break
;
...
...
@@ -763,14 +763,14 @@ static BOOL FindDfltProvRegVals(DWORD dwProvType, DWORD dwFlags, LPSTR *pszProvN
}
else
return
FALSE
;
if
(
RegOpenKey
((
dwFlags
&
CRYPT_USER_DEFAULT
)
?
HKEY_CURRENT_USER
:
HKEY_LOCAL_MACHINE
,
keyname
,
&
hKey
))
if
(
RegOpenKey
A
((
dwFlags
&
CRYPT_USER_DEFAULT
)
?
HKEY_CURRENT_USER
:
HKEY_LOCAL_MACHINE
,
keyname
,
&
hKey
))
{
LocalFree
(
keyname
);
return
FALSE
;
}
LocalFree
(
keyname
);
if
(
RegQueryValueEx
(
hKey
,
"Name"
,
NULL
,
NULL
,
(
LPBYTE
)
*
pszProvName
,
pcbProvName
))
if
(
RegQueryValueEx
A
(
hKey
,
"Name"
,
NULL
,
NULL
,
(
LPBYTE
)
*
pszProvName
,
pcbProvName
))
{
if
(
GetLastError
()
!=
ERROR_MORE_DATA
)
SetLastError
(
NTE_PROV_TYPE_ENTRY_BAD
);
...
...
@@ -780,7 +780,7 @@ static BOOL FindDfltProvRegVals(DWORD dwProvType, DWORD dwFlags, LPSTR *pszProvN
if
(
!
(
*
pszProvName
=
LocalAlloc
(
LMEM_ZEROINIT
,
*
pcbProvName
)))
return
FALSE
;
if
(
RegQueryValueEx
(
hKey
,
"Name"
,
NULL
,
NULL
,
(
LPBYTE
)
*
pszProvName
,
pcbProvName
))
if
(
RegQueryValueEx
A
(
hKey
,
"Name"
,
NULL
,
NULL
,
(
LPBYTE
)
*
pszProvName
,
pcbProvName
))
{
if
(
GetLastError
()
!=
ERROR_MORE_DATA
)
SetLastError
(
NTE_PROV_TYPE_ENTRY_BAD
);
...
...
@@ -899,13 +899,13 @@ static void test_set_provider_ex(void)
ok
(
result
,
"%d
\n
"
,
GetLastError
());
/* check pdwReserved for NULL */
result
=
pCryptSetProviderExA
(
MS_DEF_PROV
,
PROV_RSA_FULL
,
&
notNull
,
CRYPT_MACHINE_DEFAULT
);
result
=
pCryptSetProviderExA
(
MS_DEF_PROV
_A
,
PROV_RSA_FULL
,
&
notNull
,
CRYPT_MACHINE_DEFAULT
);
ok
(
!
result
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected %i, got %d
\n
"
,
ERROR_INVALID_PARAMETER
,
GetLastError
());
/* remove the default provider and then set it to MS_DEF_PROV/PROV_RSA_FULL */
SetLastError
(
0xdeadbeef
);
result
=
pCryptSetProviderExA
(
MS_DEF_PROV
,
PROV_RSA_FULL
,
NULL
,
CRYPT_MACHINE_DEFAULT
|
CRYPT_DELETE_DEFAULT
);
result
=
pCryptSetProviderExA
(
MS_DEF_PROV
_A
,
PROV_RSA_FULL
,
NULL
,
CRYPT_MACHINE_DEFAULT
|
CRYPT_DELETE_DEFAULT
);
if
(
!
result
)
{
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
||
broken
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
),
...
...
@@ -915,7 +915,7 @@ static void test_set_provider_ex(void)
return
;
}
result
=
pCryptSetProviderExA
(
MS_DEF_PROV
,
PROV_RSA_FULL
,
NULL
,
CRYPT_MACHINE_DEFAULT
);
result
=
pCryptSetProviderExA
(
MS_DEF_PROV
_A
,
PROV_RSA_FULL
,
NULL
,
CRYPT_MACHINE_DEFAULT
);
ok
(
result
,
"%d
\n
"
,
GetLastError
());
/* call CryptGetDefaultProvider to see if they match */
...
...
@@ -925,8 +925,8 @@ static void test_set_provider_ex(void)
goto
reset
;
result
=
pCryptGetDefaultProviderA
(
PROV_RSA_FULL
,
NULL
,
CRYPT_MACHINE_DEFAULT
,
pszProvName
,
&
cbProvName
);
ok
(
result
&&
!
strcmp
(
MS_DEF_PROV
,
pszProvName
),
"expected %s, got %s
\n
"
,
MS_DEF_PROV
,
pszProvName
);
ok
(
result
&&
cbProvName
==
(
strlen
(
MS_DEF_PROV
)
+
1
),
"expected %i, got %d
\n
"
,
(
lstrlenA
(
MS_DEF_PROV
)
+
1
),
cbProvName
);
ok
(
result
&&
!
strcmp
(
MS_DEF_PROV
_A
,
pszProvName
),
"expected %s, got %s
\n
"
,
MS_DEF_PROV_A
,
pszProvName
);
ok
(
result
&&
cbProvName
==
(
strlen
(
MS_DEF_PROV
_A
)
+
1
),
"expected %i, got %d
\n
"
,
(
lstrlenA
(
MS_DEF_PROV_A
)
+
1
),
cbProvName
);
LocalFree
(
pszProvName
);
...
...
@@ -1026,7 +1026,7 @@ static void test_rc2_keylen(void)
}
SetLastError
(
0xdeadbeef
);
ret
=
pCryptAcquireContextA
(
&
provider
,
NULL
,
MS_DEF_PROV
,
ret
=
pCryptAcquireContextA
(
&
provider
,
NULL
,
MS_DEF_PROV
_A
,
PROV_RSA_FULL
,
CRYPT_VERIFYCONTEXT
);
ok
(
ret
,
"CryptAcquireContext error %08x
\n
"
,
GetLastError
());
...
...
dlls/advapi32/tests/eventlog.c
View file @
f6b2aa4a
...
...
@@ -761,11 +761,11 @@ static void test_readwrite(void)
}
SetLastError
(
0xdeadbeef
);
ret
=
ReportEvent
(
handle
,
0x20
,
0
,
0
,
NULL
,
0
,
0
,
NULL
,
NULL
);
ret
=
ReportEvent
A
(
handle
,
0x20
,
0
,
0
,
NULL
,
0
,
0
,
NULL
,
NULL
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_CRC
)
{
win_skip
(
"Win7 fails when using incorrect event types
\n
"
);
ret
=
ReportEvent
(
handle
,
0
,
0
,
0
,
NULL
,
0
,
0
,
NULL
,
NULL
);
ret
=
ReportEvent
A
(
handle
,
0
,
0
,
0
,
NULL
,
0
,
0
,
NULL
,
NULL
);
ok
(
ret
,
"Expected success : %d
\n
"
,
GetLastError
());
}
else
...
...
@@ -822,9 +822,9 @@ static void test_readwrite(void)
ok
(
handle
!=
NULL
,
"Expected a handle
\n
"
);
SetLastError
(
0xdeadbeef
);
ret
=
ReportEvent
(
handle
,
read_write
[
i
].
evt_type
,
read_write
[
i
].
evt_cat
,
read_write
[
i
].
evt_id
,
run_sidtests
?
user
:
NULL
,
read_write
[
i
].
evt_numstrings
,
0
,
read_write
[
i
].
evt_strings
,
NULL
);
ret
=
ReportEvent
A
(
handle
,
read_write
[
i
].
evt_type
,
read_write
[
i
].
evt_cat
,
read_write
[
i
].
evt_id
,
run_sidtests
?
user
:
NULL
,
read_write
[
i
].
evt_numstrings
,
0
,
read_write
[
i
].
evt_strings
,
NULL
);
ok
(
ret
,
"Expected ReportEvent success : %d
\n
"
,
GetLastError
());
count
=
0xdeadbeef
;
...
...
dlls/advapi32/tests/lsa.c
View file @
f6b2aa4a
...
...
@@ -47,7 +47,7 @@ static NTSTATUS (WINAPI *pLsaLookupSids)(LSA_HANDLE,ULONG,PSID*,LSA_REFERENCED_D
static
BOOL
init
(
void
)
{
hadvapi32
=
GetModuleHandle
(
"advapi32.dll"
);
hadvapi32
=
GetModuleHandle
A
(
"advapi32.dll"
);
pLsaClose
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"LsaClose"
);
pLsaEnumerateAccountRights
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"LsaEnumerateAccountRights"
);
...
...
dlls/advapi32/tests/registry.c
View file @
f6b2aa4a
...
...
@@ -31,6 +31,11 @@
#include "winerror.h"
#include "aclapi.h"
#undef SE_BACKUP_NAME
#undef SE_RESTORE_NAME
#define SE_BACKUP_NAME "SeBackupPrivilege"
#define SE_RESTORE_NAME "SeRestorePrivilege"
#define IS_HKCR(hk) ((UINT_PTR)hk > 0 && ((UINT_PTR)hk & 3) == 2)
static
HKEY
hkey_main
;
...
...
@@ -1084,8 +1089,8 @@ static void test_reg_create_key(void)
ok
(
!
ret
,
"RegCreateKeyExA failed with error %d
\n
"
,
ret
);
/* clean up */
RegDeleteKey
(
hkey2
,
""
);
RegDeleteKey
(
hkey1
,
""
);
RegDeleteKey
A
(
hkey2
,
""
);
RegDeleteKey
A
(
hkey1
,
""
);
RegCloseKey
(
hkey2
);
RegCloseKey
(
hkey1
);
...
...
@@ -1103,8 +1108,8 @@ static void test_reg_create_key(void)
ok
(
!
ret
,
"RegCreateKeyExA failed with error %d
\n
"
,
ret
);
/* clean up */
RegDeleteKey
(
hkey2
,
""
);
RegDeleteKey
(
hkey1
,
""
);
RegDeleteKey
A
(
hkey2
,
""
);
RegDeleteKey
A
(
hkey1
,
""
);
RegCloseKey
(
hkey2
);
RegCloseKey
(
hkey1
);
...
...
@@ -1114,7 +1119,7 @@ static void test_reg_create_key(void)
ok
(
ret
==
ERROR_BAD_PATHNAME
,
"expected ERROR_BAD_PATHNAME, got %d
\n
"
,
ret
);
else
{
ok
(
!
ret
,
"RegCreateKeyExA failed with error %d
\n
"
,
ret
);
RegDeleteKey
(
hkey1
,
NULL
);
RegDeleteKey
A
(
hkey1
,
NULL
);
RegCloseKey
(
hkey1
);
}
...
...
@@ -1248,7 +1253,7 @@ static void test_reg_delete_key(void)
{
DWORD
ret
;
ret
=
RegDeleteKey
(
hkey_main
,
NULL
);
ret
=
RegDeleteKey
A
(
hkey_main
,
NULL
);
/* There is a bug in NT4 and W2K that doesn't check if the subkey is NULL. If
* there are also no subkeys available it will delete the key pointed to by hkey_main.
...
...
@@ -1271,7 +1276,7 @@ static void test_reg_save_key(void)
{
DWORD
ret
;
ret
=
RegSaveKey
(
hkey_main
,
"saved_key"
,
NULL
);
ret
=
RegSaveKey
A
(
hkey_main
,
"saved_key"
,
NULL
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
}
...
...
@@ -1280,10 +1285,10 @@ static void test_reg_load_key(void)
DWORD
ret
;
HKEY
hkHandle
;
ret
=
RegLoadKey
(
HKEY_LOCAL_MACHINE
,
"Test"
,
"saved_key"
);
ret
=
RegLoadKey
A
(
HKEY_LOCAL_MACHINE
,
"Test"
,
"saved_key"
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ret
=
RegOpenKey
(
HKEY_LOCAL_MACHINE
,
"Test"
,
&
hkHandle
);
ret
=
RegOpenKey
A
(
HKEY_LOCAL_MACHINE
,
"Test"
,
&
hkHandle
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
RegCloseKey
(
hkHandle
);
...
...
@@ -1293,11 +1298,11 @@ static void test_reg_unload_key(void)
{
DWORD
ret
;
ret
=
RegUnLoadKey
(
HKEY_LOCAL_MACHINE
,
"Test"
);
ret
=
RegUnLoadKey
A
(
HKEY_LOCAL_MACHINE
,
"Test"
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
DeleteFile
(
"saved_key"
);
DeleteFile
(
"saved_key.LOG"
);
DeleteFile
A
(
"saved_key"
);
DeleteFile
A
(
"saved_key.LOG"
);
}
static
BOOL
set_privileges
(
LPCSTR
privilege
,
BOOL
set
)
...
...
@@ -1309,7 +1314,7 @@ static BOOL set_privileges(LPCSTR privilege, BOOL set)
if
(
!
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_ADJUST_PRIVILEGES
,
&
hToken
))
return
FALSE
;
if
(
!
LookupPrivilegeValue
(
NULL
,
privilege
,
&
luid
))
if
(
!
LookupPrivilegeValue
A
(
NULL
,
privilege
,
&
luid
))
{
CloseHandle
(
hToken
);
return
FALSE
;
...
...
@@ -1704,7 +1709,7 @@ static void test_rw_order(void)
ok
(
!
RegEnumValueA
(
hKey
,
3
,
value_buf
,
&
value_len
,
NULL
,
NULL
,
NULL
,
NULL
),
"RegEnumValueA failed
\n
"
);
todo_wine
ok
(
strcmp
(
value_buf
,
"B"
)
==
0
,
"Expected name
\"
B
\"
, got %s
\n
"
,
value_buf
);
ok
(
!
RegDeleteKey
(
HKEY_CURRENT_USER
,
keyname
),
"Failed to delete key
\n
"
);
ok
(
!
RegDeleteKey
A
(
HKEY_CURRENT_USER
,
keyname
),
"Failed to delete key
\n
"
);
}
static
void
test_symlinks
(
void
)
...
...
@@ -1822,10 +1827,10 @@ static void test_symlinks(void)
KEY_ALL_ACCESS
,
NULL
,
&
key
,
NULL
);
ok
(
err
==
ERROR_ALREADY_EXISTS
,
"RegCreateKeyEx wrong error %u
\n
"
,
err
);
err
=
RegDeleteKey
(
hkey_main
,
"target"
);
err
=
RegDeleteKey
A
(
hkey_main
,
"target"
);
ok
(
err
==
ERROR_SUCCESS
,
"RegDeleteKey failed error %u
\n
"
,
err
);
err
=
RegDeleteKey
(
hkey_main
,
"link"
);
err
=
RegDeleteKey
A
(
hkey_main
,
"link"
);
ok
(
err
==
ERROR_FILE_NOT_FOUND
,
"RegDeleteKey wrong error %u
\n
"
,
err
);
status
=
pNtDeleteKey
(
link
);
...
...
@@ -2362,7 +2367,7 @@ static void test_classesroot(void)
RegCloseKey
(
hklmsub1
);
/* delete subkey1 from hkcr (should point at user's classes) */
res
=
RegDeleteKey
(
hkcr
,
"subkey1"
);
res
=
RegDeleteKey
A
(
hkcr
,
"subkey1"
);
ok
(
res
==
ERROR_SUCCESS
,
"RegDeleteKey failed: %d
\n
"
,
res
);
/* confirm key was removed in hkey but not hklm */
...
...
@@ -2373,7 +2378,7 @@ static void test_classesroot(void)
ok
(
!
IS_HKCR
(
hklmsub1
),
"hkcr mask set in %p
\n
"
,
hklmsub1
);
/* delete subkey1 from hkcr again (which should now point at hklm) */
res
=
RegDeleteKey
(
hkcr
,
"subkey1"
);
res
=
RegDeleteKey
A
(
hkcr
,
"subkey1"
);
ok
(
res
==
ERROR_SUCCESS
,
"RegDeleteKey failed: %d
\n
"
,
res
);
/* confirm hkey was removed in hklm */
...
...
dlls/advapi32/tests/security.c
View file @
f6b2aa4a
...
...
@@ -101,7 +101,7 @@ static BOOL (WINAPI *pSetFileSecurityA)(LPCSTR, SECURITY_INFORMATION,
static
DWORD
(
WINAPI
*
pGetNamedSecurityInfoA
)(
LPSTR
,
SE_OBJECT_TYPE
,
SECURITY_INFORMATION
,
PSID
*
,
PSID
*
,
PACL
*
,
PACL
*
,
PSECURITY_DESCRIPTOR
*
);
static
DWORD
(
WINAPI
*
pSetNamedSecurityInfoA
)(
LP
T
STR
,
SE_OBJECT_TYPE
,
SECURITY_INFORMATION
,
static
DWORD
(
WINAPI
*
pSetNamedSecurityInfoA
)(
LPSTR
,
SE_OBJECT_TYPE
,
SECURITY_INFORMATION
,
PSID
,
PSID
,
PACL
,
PACL
);
static
PDWORD
(
WINAPI
*
pGetSidSubAuthority
)(
PSID
,
DWORD
);
static
PUCHAR
(
WINAPI
*
pGetSidSubAuthorityCount
)(
PSID
);
...
...
@@ -157,7 +157,7 @@ static void init(void)
pNtQueryObject
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtQueryObject"
);
pNtAccessCheck
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtAccessCheck"
);
hmod
=
GetModuleHandle
(
"advapi32.dll"
);
hmod
=
GetModuleHandle
A
(
"advapi32.dll"
);
pAddAccessAllowedAceEx
=
(
void
*
)
GetProcAddress
(
hmod
,
"AddAccessAllowedAceEx"
);
pAddAccessDeniedAceEx
=
(
void
*
)
GetProcAddress
(
hmod
,
"AddAccessDeniedAceEx"
);
pAddAuditAccessAceEx
=
(
void
*
)
GetProcAddress
(
hmod
,
"AddAuditAccessAceEx"
);
...
...
@@ -342,9 +342,9 @@ static void test_trustee(void)
GUID
ObjectType
=
{
0x12345678
,
0x1234
,
0x5678
,
{
0x11
,
0x22
,
0x33
,
0x44
,
0x55
,
0x66
,
0x77
,
0x88
}};
GUID
InheritedObjectType
=
{
0x23456789
,
0x2345
,
0x6786
,
{
0x2
,
0x33
,
0x44
,
0x55
,
0x66
,
0x77
,
0x88
,
0x99
}};
GUID
ZeroGuid
;
OBJECTS_AND_NAME_
oan
;
OBJECTS_AND_NAME_
A
oan
;
OBJECTS_AND_SID
oas
;
TRUSTEE
trustee
;
TRUSTEE
A
trustee
;
PSID
psid
;
char
szObjectTypeName
[]
=
"ObjectTypeName"
;
char
szInheritedObjectTypeName
[]
=
"InheritedObjectTypeName"
;
...
...
@@ -440,7 +440,7 @@ static void test_trustee(void)
ok
(
trustee
.
MultipleTrusteeOperation
==
NO_MULTIPLE_TRUSTEE
,
"MultipleTrusteeOperation wrong
\n
"
);
ok
(
trustee
.
TrusteeForm
==
TRUSTEE_IS_OBJECTS_AND_NAME
,
"TrusteeForm wrong
\n
"
);
ok
(
trustee
.
TrusteeType
==
TRUSTEE_IS_UNKNOWN
,
"TrusteeType wrong
\n
"
);
ok
(
trustee
.
ptstrName
==
(
LP
T
STR
)
&
oan
,
"ptstrName wrong
\n
"
);
ok
(
trustee
.
ptstrName
==
(
LPSTR
)
&
oan
,
"ptstrName wrong
\n
"
);
ok
(
oan
.
ObjectsPresent
==
(
ACE_OBJECT_TYPE_PRESENT
|
ACE_INHERITED_OBJECT_TYPE_PRESENT
),
"ObjectsPresent wrong
\n
"
);
ok
(
oan
.
ObjectType
==
SE_KERNEL_OBJECT
,
"ObjectType wrong
\n
"
);
...
...
@@ -477,7 +477,7 @@ static void test_trustee(void)
ok
(
trustee
.
MultipleTrusteeOperation
==
NO_MULTIPLE_TRUSTEE
,
"MultipleTrusteeOperation wrong
\n
"
);
ok
(
trustee
.
TrusteeForm
==
TRUSTEE_IS_OBJECTS_AND_NAME
,
"TrusteeForm wrong
\n
"
);
ok
(
trustee
.
TrusteeType
==
TRUSTEE_IS_UNKNOWN
,
"TrusteeType wrong
\n
"
);
ok
(
trustee
.
ptstrName
==
(
LP
T
STR
)
&
oan
,
"ptstrName wrong
\n
"
);
ok
(
trustee
.
ptstrName
==
(
LPSTR
)
&
oan
,
"ptstrName wrong
\n
"
);
ok
(
oan
.
ObjectsPresent
==
ACE_OBJECT_TYPE_PRESENT
,
"ObjectsPresent wrong
\n
"
);
ok
(
oan
.
ObjectType
==
SE_KERNEL_OBJECT
,
"ObjectType wrong
\n
"
);
...
...
@@ -830,20 +830,20 @@ cleanup:
/* Test file access permissions for a file with FILE_ATTRIBUTE_ARCHIVE */
SetLastError
(
0xdeadbeef
);
rc
=
GetTempPath
(
sizeof
(
wintmpdir
),
wintmpdir
);
rc
=
GetTempPath
A
(
sizeof
(
wintmpdir
),
wintmpdir
);
ok
(
rc
,
"GetTempPath error %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
rc
=
GetTempFileName
(
wintmpdir
,
"tmp"
,
0
,
file
);
rc
=
GetTempFileName
A
(
wintmpdir
,
"tmp"
,
0
,
file
);
ok
(
rc
,
"GetTempFileName error %d
\n
"
,
GetLastError
());
rc
=
GetFileAttributes
(
file
);
rc
=
GetFileAttributes
A
(
file
);
rc
&=
~
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
;
ok
(
rc
==
FILE_ATTRIBUTE_ARCHIVE
,
"expected FILE_ATTRIBUTE_ARCHIVE got %#x
\n
"
,
rc
);
retSize
=
0xdeadbeef
;
rc
=
GetFileSecurity
(
file
,
OWNER_SECURITY_INFORMATION
|
GROUP_SECURITY_INFORMATION
|
DACL_SECURITY_INFORMATION
,
NULL
,
0
,
&
sdSize
);
rc
=
GetFileSecurity
A
(
file
,
OWNER_SECURITY_INFORMATION
|
GROUP_SECURITY_INFORMATION
|
DACL_SECURITY_INFORMATION
,
NULL
,
0
,
&
sdSize
);
ok
(
!
rc
,
"GetFileSecurity should fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"expected ERROR_INSUFFICIENT_BUFFER got %d
\n
"
,
GetLastError
());
...
...
@@ -852,8 +852,8 @@ cleanup:
sd
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sdSize
);
retSize
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
rc
=
GetFileSecurity
(
file
,
OWNER_SECURITY_INFORMATION
|
GROUP_SECURITY_INFORMATION
|
DACL_SECURITY_INFORMATION
,
sd
,
sdSize
,
&
retSize
);
rc
=
GetFileSecurity
A
(
file
,
OWNER_SECURITY_INFORMATION
|
GROUP_SECURITY_INFORMATION
|
DACL_SECURITY_INFORMATION
,
sd
,
sdSize
,
&
retSize
);
ok
(
rc
,
"GetFileSecurity error %d
\n
"
,
GetLastError
());
ok
(
retSize
==
sdSize
||
broken
(
retSize
==
0
)
/* NT4 */
,
"expected %d, got %d
\n
"
,
sdSize
,
retSize
);
...
...
@@ -938,7 +938,7 @@ cleanup:
/* Test file access permissions for a file with FILE_ATTRIBUTE_READONLY */
SetLastError
(
0xdeadbeef
);
fh
=
CreateFile
(
file
,
FILE_READ_DATA
,
FILE_SHARE_READ
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_READONLY
,
0
);
fh
=
CreateFile
A
(
file
,
FILE_READ_DATA
,
FILE_SHARE_READ
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_READONLY
,
0
);
ok
(
fh
!=
INVALID_HANDLE_VALUE
,
"CreateFile error %d
\n
"
,
GetLastError
());
retSize
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
...
...
@@ -948,21 +948,21 @@ cleanup:
ok
(
retSize
==
0
,
"expected 0, got %d
\n
"
,
retSize
);
CloseHandle
(
fh
);
rc
=
GetFileAttributes
(
file
);
rc
=
GetFileAttributes
A
(
file
);
rc
&=
~
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
;
todo_wine
ok
(
rc
==
(
FILE_ATTRIBUTE_ARCHIVE
|
FILE_ATTRIBUTE_READONLY
),
"expected FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY got %#x
\n
"
,
rc
);
SetLastError
(
0xdeadbeef
);
rc
=
SetFileAttributes
(
file
,
FILE_ATTRIBUTE_ARCHIVE
);
rc
=
SetFileAttributes
A
(
file
,
FILE_ATTRIBUTE_ARCHIVE
);
ok
(
rc
,
"SetFileAttributes error %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
rc
=
DeleteFile
(
file
);
rc
=
DeleteFile
A
(
file
);
ok
(
rc
,
"DeleteFile error %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
fh
=
CreateFile
(
file
,
FILE_READ_DATA
,
FILE_SHARE_READ
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_READONLY
,
0
);
fh
=
CreateFile
A
(
file
,
FILE_READ_DATA
,
FILE_SHARE_READ
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_READONLY
,
0
);
ok
(
fh
!=
INVALID_HANDLE_VALUE
,
"CreateFile error %d
\n
"
,
GetLastError
());
retSize
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
...
...
@@ -972,15 +972,15 @@ todo_wine
ok
(
retSize
==
0
,
"expected 0, got %d
\n
"
,
retSize
);
CloseHandle
(
fh
);
rc
=
GetFileAttributes
(
file
);
rc
=
GetFileAttributes
A
(
file
);
rc
&=
~
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
;
ok
(
rc
==
(
FILE_ATTRIBUTE_ARCHIVE
|
FILE_ATTRIBUTE_READONLY
),
"expected FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY got %#x
\n
"
,
rc
);
retSize
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
rc
=
GetFileSecurity
(
file
,
OWNER_SECURITY_INFORMATION
|
GROUP_SECURITY_INFORMATION
|
DACL_SECURITY_INFORMATION
,
sd
,
sdSize
,
&
retSize
);
rc
=
GetFileSecurity
A
(
file
,
OWNER_SECURITY_INFORMATION
|
GROUP_SECURITY_INFORMATION
|
DACL_SECURITY_INFORMATION
,
sd
,
sdSize
,
&
retSize
);
ok
(
rc
,
"GetFileSecurity error %d
\n
"
,
GetLastError
());
ok
(
retSize
==
sdSize
||
broken
(
retSize
==
0
)
/* NT4 */
,
"expected %d, got %d
\n
"
,
sdSize
,
retSize
);
...
...
@@ -1047,14 +1047,14 @@ todo_wine {
ok
(
granted
==
FILE_ALL_ACCESS
,
"expected FILE_ALL_ACCESS, got %#x
\n
"
,
granted
);
}
SetLastError
(
0xdeadbeef
);
rc
=
DeleteFile
(
file
);
rc
=
DeleteFile
A
(
file
);
ok
(
!
rc
,
"DeleteFile should fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"expected ERROR_ACCESS_DENIED, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
rc
=
SetFileAttributes
(
file
,
FILE_ATTRIBUTE_ARCHIVE
);
rc
=
SetFileAttributes
A
(
file
,
FILE_ATTRIBUTE_ARCHIVE
);
ok
(
rc
,
"SetFileAttributes error %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
rc
=
DeleteFile
(
file
);
rc
=
DeleteFile
A
(
file
);
ok
(
rc
,
"DeleteFile error %d
\n
"
,
GetLastError
());
CloseHandle
(
token
);
...
...
@@ -1082,7 +1082,7 @@ static void test_AccessCheck(void)
DWORD
err
;
NTSTATUS
ntret
,
ntAccessStatus
;
NtDllModule
=
GetModuleHandle
(
"ntdll.dll"
);
NtDllModule
=
GetModuleHandle
A
(
"ntdll.dll"
);
if
(
!
NtDllModule
)
{
skip
(
"not running on NT, skipping test
\n
"
);
...
...
@@ -1490,13 +1490,13 @@ static void test_token_attr(void)
for
(
i
=
0
;
i
<
Groups
->
GroupCount
;
i
++
)
{
DWORD
NameLength
=
255
;
T
CHAR
Name
[
255
];
CHAR
Name
[
255
];
DWORD
DomainLength
=
255
;
T
CHAR
Domain
[
255
];
CHAR
Domain
[
255
];
SID_NAME_USE
SidNameUse
;
Name
[
0
]
=
'\0'
;
Domain
[
0
]
=
'\0'
;
ret
=
LookupAccountSid
(
NULL
,
Groups
->
Groups
[
i
].
Sid
,
Name
,
&
NameLength
,
Domain
,
&
DomainLength
,
&
SidNameUse
);
ret
=
LookupAccountSid
A
(
NULL
,
Groups
->
Groups
[
i
].
Sid
,
Name
,
&
NameLength
,
Domain
,
&
DomainLength
,
&
SidNameUse
);
if
(
ret
)
{
pConvertSidToStringSidA
(
Groups
->
Groups
[
i
].
Sid
,
&
SidString
);
...
...
@@ -1532,9 +1532,9 @@ static void test_token_attr(void)
trace
(
"TokenPrivileges:
\n
"
);
for
(
i
=
0
;
i
<
Privileges
->
PrivilegeCount
;
i
++
)
{
T
CHAR
Name
[
256
];
CHAR
Name
[
256
];
DWORD
NameLen
=
sizeof
(
Name
)
/
sizeof
(
Name
[
0
]);
LookupPrivilegeName
(
NULL
,
&
Privileges
->
Privileges
[
i
].
Luid
,
Name
,
&
NameLen
);
LookupPrivilegeName
A
(
NULL
,
&
Privileges
->
Privileges
[
i
].
Luid
,
Name
,
&
NameLen
);
trace
(
"
\t
%s, 0x%x
\n
"
,
Name
,
Privileges
->
Privileges
[
i
].
Attributes
);
}
HeapFree
(
GetProcessHeap
(),
0
,
Privileges
);
...
...
@@ -1615,7 +1615,7 @@ static void test_sid_str(PSID * sid)
SID_NAME_USE
use
;
DWORD
acc_size
=
MAX_PATH
;
DWORD
dom_size
=
MAX_PATH
;
ret
=
LookupAccountSid
(
NULL
,
sid
,
account
,
&
acc_size
,
domain
,
&
dom_size
,
&
use
);
ret
=
LookupAccountSid
A
(
NULL
,
sid
,
account
,
&
acc_size
,
domain
,
&
dom_size
,
&
use
);
ok
(
ret
||
(
!
ret
&&
(
GetLastError
()
==
ERROR_NONE_MAPPED
)),
"LookupAccountSid(%s) failed: %d
\n
"
,
str_sid
,
GetLastError
());
if
(
ret
)
...
...
@@ -2117,8 +2117,8 @@ static void check_wellknown_name(const char* name, WELL_KNOWN_SID_TYPE result)
ok
(
EqualSid
(
psid
,
wk_sid
),
"(%s) Sids fail to match well known sid!
\n
"
,
name
);
ok
(
!
lstrcmp
(
account
,
wk_account
),
"Expected %s , got %s
\n
"
,
account
,
wk_account
);
ok
(
!
lstrcmp
(
domain
,
wk_domain
),
"Expected %s, got %s
\n
"
,
wk_domain
,
domain
);
ok
(
!
lstrcmp
A
(
account
,
wk_account
),
"Expected %s , got %s
\n
"
,
account
,
wk_account
);
ok
(
!
lstrcmp
A
(
domain
,
wk_domain
),
"Expected %s, got %s
\n
"
,
wk_domain
,
domain
);
ok
(
sid_use
==
SidTypeWellKnownGroup
,
"Expected Use (5), got %d
\n
"
,
sid_use
);
cleanup:
...
...
@@ -2179,10 +2179,10 @@ static void test_LookupAccountName(void)
get_sid_info
(
psid
,
&
account
,
&
sid_dom
);
ok
(
ret
,
"Failed to lookup account name
\n
"
);
ok
(
sid_size
==
GetLengthSid
(
psid
),
"Expected %d, got %d
\n
"
,
GetLengthSid
(
psid
),
sid_size
);
ok
(
!
lstrcmp
(
account
,
user_name
),
"Expected %s, got %s
\n
"
,
user_name
,
account
);
ok
(
!
lstrcmp
(
domain
,
sid_dom
),
"Expected %s, got %s
\n
"
,
sid_dom
,
domain
);
ok
(
!
lstrcmp
A
(
account
,
user_name
),
"Expected %s, got %s
\n
"
,
user_name
,
account
);
ok
(
!
lstrcmp
A
(
domain
,
sid_dom
),
"Expected %s, got %s
\n
"
,
sid_dom
,
domain
);
ok
(
domain_size
==
domain_save
-
1
,
"Expected %d, got %d
\n
"
,
domain_save
-
1
,
domain_size
);
ok
(
strlen
(
domain
)
==
domain_size
,
"Expected %d, got %d
\n
"
,
lstrlen
(
domain
),
domain_size
);
ok
(
strlen
(
domain
)
==
domain_size
,
"Expected %d, got %d
\n
"
,
lstrlen
A
(
domain
),
domain_size
);
ok
(
sid_use
==
SidTypeUser
,
"Expected SidTypeUser (%d), got %d
\n
"
,
SidTypeUser
,
sid_use
);
domain_size
=
domain_save
;
sid_size
=
sid_save
;
...
...
@@ -2197,10 +2197,10 @@ static void test_LookupAccountName(void)
get_sid_info
(
psid
,
&
account
,
&
sid_dom
);
ok
(
ret
,
"Failed to lookup account name
\n
"
);
ok
(
sid_size
!=
0
,
"sid_size was zero
\n
"
);
ok
(
!
lstrcmp
(
account
,
"Everyone"
),
"Expected Everyone, got %s
\n
"
,
account
);
ok
(
!
lstrcmp
(
domain
,
sid_dom
),
"Expected %s, got %s
\n
"
,
sid_dom
,
domain
);
ok
(
!
lstrcmp
A
(
account
,
"Everyone"
),
"Expected Everyone, got %s
\n
"
,
account
);
ok
(
!
lstrcmp
A
(
domain
,
sid_dom
),
"Expected %s, got %s
\n
"
,
sid_dom
,
domain
);
ok
(
domain_size
==
0
,
"Expected 0, got %d
\n
"
,
domain_size
);
ok
(
strlen
(
domain
)
==
domain_size
,
"Expected %d, got %d
\n
"
,
lstrlen
(
domain
),
domain_size
);
ok
(
strlen
(
domain
)
==
domain_size
,
"Expected %d, got %d
\n
"
,
lstrlen
A
(
domain
),
domain_size
);
ok
(
sid_use
==
SidTypeWellKnownGroup
,
"Expected SidTypeWellKnownGroup (%d), got %d
\n
"
,
SidTypeWellKnownGroup
,
sid_use
);
domain_size
=
domain_save
;
}
...
...
@@ -2263,7 +2263,7 @@ static void test_LookupAccountName(void)
get_sid_info
(
psid
,
&
account
,
&
sid_dom
);
ok
(
ret
,
"Failed to lookup account name
\n
"
);
/* Using a fixed string will not work on different locales */
ok
(
!
lstrcmp
(
account
,
domain
),
ok
(
!
lstrcmp
A
(
account
,
domain
),
"Got %s for account and %s for domain, these should be the same
\n
"
,
account
,
domain
);
ok
(
sid_use
==
SidTypeDomain
,
"Expected SidTypeDomain (%d), got %d
\n
"
,
SidTypeDomain
,
sid_use
);
...
...
@@ -2519,7 +2519,7 @@ static void test_process_security(void)
res
=
InitializeSecurityDescriptor
(
SecurityDescriptor
,
SECURITY_DESCRIPTOR_REVISION
);
ok
(
res
,
"InitializeSecurityDescriptor failed with error %d
\n
"
,
GetLastError
());
event
=
CreateEvent
(
NULL
,
TRUE
,
TRUE
,
"test_event"
);
event
=
CreateEvent
A
(
NULL
,
TRUE
,
TRUE
,
"test_event"
);
ok
(
event
!=
NULL
,
"CreateEvent %d
\n
"
,
GetLastError
());
SecurityDescriptor
->
Revision
=
0
;
...
...
@@ -2661,7 +2661,7 @@ static void test_impersonation_level(void)
ok
(
error
==
ERROR_CANT_OPEN_ANONYMOUS
,
"OpenThreadToken on anonymous token should have returned ERROR_CANT_OPEN_ANONYMOUS instead of %d
\n
"
,
error
);
/* can't perform access check when opening object against an anonymous impersonation token */
todo_wine
{
error
=
RegOpenKeyEx
(
HKEY_CURRENT_USER
,
"Software"
,
0
,
KEY_READ
,
&
hkey
);
error
=
RegOpenKeyEx
A
(
HKEY_CURRENT_USER
,
"Software"
,
0
,
KEY_READ
,
&
hkey
);
ok
(
error
==
ERROR_INVALID_HANDLE
||
error
==
ERROR_CANT_OPEN_ANONYMOUS
,
"RegOpenKeyEx should have failed with ERROR_INVALID_HANDLE or ERROR_CANT_OPEN_ANONYMOUS instead of %d
\n
"
,
error
);
}
...
...
@@ -2714,7 +2714,7 @@ static void test_impersonation_level(void)
ok
(
ret
,
"OpenThreadToken failed with error %d
\n
"
,
GetLastError
());
/* can't perform access check when opening object against an identification impersonation token */
error
=
RegOpenKeyEx
(
HKEY_CURRENT_USER
,
"Software"
,
0
,
KEY_READ
,
&
hkey
);
error
=
RegOpenKeyEx
A
(
HKEY_CURRENT_USER
,
"Software"
,
0
,
KEY_READ
,
&
hkey
);
todo_wine
{
ok
(
error
==
ERROR_INVALID_HANDLE
||
error
==
ERROR_BAD_IMPERSONATION_LEVEL
,
"RegOpenKeyEx should have failed with ERROR_INVALID_HANDLE or ERROR_BAD_IMPERSONATION_LEVEL instead of %d
\n
"
,
error
);
...
...
@@ -2728,7 +2728,7 @@ static void test_impersonation_level(void)
ok
(
ret
,
"ImpersonateSelf(SecurityImpersonation) failed with error %d
\n
"
,
GetLastError
());
ret
=
OpenThreadToken
(
GetCurrentThread
(),
TOKEN_QUERY
|
TOKEN_ADJUST_PRIVILEGES
|
TOKEN_QUERY_SOURCE
|
TOKEN_IMPERSONATE
|
TOKEN_ADJUST_DEFAULT
,
TRUE
,
&
Token
);
ok
(
ret
,
"OpenThreadToken failed with error %d
\n
"
,
GetLastError
());
error
=
RegOpenKeyEx
(
HKEY_CURRENT_USER
,
"Software"
,
0
,
KEY_READ
,
&
hkey
);
error
=
RegOpenKeyEx
A
(
HKEY_CURRENT_USER
,
"Software"
,
0
,
KEY_READ
,
&
hkey
);
ok
(
error
==
ERROR_SUCCESS
,
"RegOpenKeyEx should have succeeded instead of failing with %d
\n
"
,
error
);
RegCloseKey
(
hkey
);
ret
=
PrivilegeCheck
(
Token
,
PrivilegeSet
,
&
AccessGranted
);
...
...
@@ -2879,7 +2879,7 @@ static void test_SetEntriesInAclA(void)
PACL
OldAcl
=
NULL
,
NewAcl
;
SID_IDENTIFIER_AUTHORITY
SIDAuthWorld
=
{
SECURITY_WORLD_SID_AUTHORITY
};
SID_IDENTIFIER_AUTHORITY
SIDAuthNT
=
{
SECURITY_NT_AUTHORITY
};
EXPLICIT_ACCESS
ExplicitAccess
;
EXPLICIT_ACCESS
A
ExplicitAccess
;
static
const
CHAR
szEveryone
[]
=
{
'E'
,
'v'
,
'e'
,
'r'
,
'y'
,
'o'
,
'n'
,
'e'
,
0
};
static
const
CHAR
szCurrentUser
[]
=
{
'C'
,
'U'
,
'R'
,
'R'
,
'E'
,
'N'
,
'T'
,
'_'
,
'U'
,
'S'
,
'E'
,
'R'
,
'\0'
};
...
...
@@ -3399,12 +3399,12 @@ static void test_ConvertSecurityDescriptorToString(void)
* don't replicate this feature so we only test len >= strlen+1. */
#define CHECK_RESULT_AND_FREE(exp_str) \
ok(strcmp(string, (exp_str)) == 0, "String mismatch (expected \"%s\", got \"%s\")\n", (exp_str), string); \
ok(len >= (strlen(exp_str) + 1), "Length mismatch (expected %d, got %d)\n", lstrlen(exp_str) + 1, len); \
ok(len >= (strlen(exp_str) + 1), "Length mismatch (expected %d, got %d)\n", lstrlen
A
(exp_str) + 1, len); \
LocalFree(string);
#define CHECK_ONE_OF_AND_FREE(exp_str1, exp_str2) \
ok(strcmp(string, (exp_str1)) == 0 || strcmp(string, (exp_str2)) == 0, "String mismatch (expected\n\"%s\" or\n\"%s\", got\n\"%s\")\n", (exp_str1), (exp_str2), string); \
ok(len >= (strlen(exp_str1) + 1) || len >= (strlen(exp_str2) + 1), "Length mismatch (expected %d or %d, got %d)\n", lstrlen
(exp_str1) + 1, lstrlen
(exp_str2) + 1, len); \
ok(len >= (strlen(exp_str1) + 1) || len >= (strlen(exp_str2) + 1), "Length mismatch (expected %d or %d, got %d)\n", lstrlen
A(exp_str1) + 1, lstrlenA
(exp_str2) + 1, len); \
LocalFree(string);
InitializeSecurityDescriptor
(
&
desc
,
SECURITY_DESCRIPTOR_REVISION
);
...
...
@@ -3757,8 +3757,8 @@ static void test_GetSecurityInfo(void)
user_sid
=
((
TOKEN_USER
*
)
b
)
->
User
.
Sid
;
/* Create something. Files have lots of associated security info. */
obj
=
CreateFile
(
myARGV
[
0
],
GENERIC_READ
|
WRITE_DAC
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
obj
=
CreateFile
A
(
myARGV
[
0
],
GENERIC_READ
|
WRITE_DAC
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
obj
==
INVALID_HANDLE_VALUE
)
{
skip
(
"Couldn't create an object for GetSecurityInfo test
\n
"
);
...
...
@@ -4397,12 +4397,12 @@ static void test_mutex_security(HANDLE token)
STANDARD_RIGHTS_ALL
|
MUTEX_ALL_ACCESS
};
SetLastError
(
0xdeadbeef
);
mutex
=
OpenMutex
(
0
,
FALSE
,
"WineTestMutex"
);
mutex
=
OpenMutex
A
(
0
,
FALSE
,
"WineTestMutex"
);
ok
(
!
mutex
,
"mutex should not exist
\n
"
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"wrong error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
mutex
=
CreateMutex
(
NULL
,
FALSE
,
"WineTestMutex"
);
mutex
=
CreateMutex
A
(
NULL
,
FALSE
,
"WineTestMutex"
);
ok
(
mutex
!=
0
,
"CreateMutex error %d
\n
"
,
GetLastError
());
test_default_handle_security
(
token
,
mutex
,
&
mapping
);
...
...
@@ -4419,12 +4419,12 @@ static void test_event_security(HANDLE token)
STANDARD_RIGHTS_ALL
|
EVENT_ALL_ACCESS
};
SetLastError
(
0xdeadbeef
);
event
=
OpenEvent
(
0
,
FALSE
,
"WineTestEvent"
);
event
=
OpenEvent
A
(
0
,
FALSE
,
"WineTestEvent"
);
ok
(
!
event
,
"event should not exist
\n
"
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"wrong error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
event
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
"WineTestEvent"
);
event
=
CreateEvent
A
(
NULL
,
FALSE
,
FALSE
,
"WineTestEvent"
);
ok
(
event
!=
0
,
"CreateEvent error %d
\n
"
,
GetLastError
());
test_default_handle_security
(
token
,
event
,
&
mapping
);
...
...
@@ -4442,22 +4442,22 @@ static void test_named_pipe_security(HANDLE token)
STANDARD_RIGHTS_ALL
|
FILE_ALL_ACCESS
};
SetLastError
(
0xdeadbeef
);
pipe
=
CreateNamedPipe
(
WINE_TEST_PIPE
,
PIPE_ACCESS_DUPLEX
|
FILE_FLAG_FIRST_PIPE_INSTANCE
,
PIPE_TYPE_BYTE
|
PIPE_NOWAIT
,
PIPE_UNLIMITED_INSTANCES
,
0
,
0
,
NMPWAIT_USE_DEFAULT_WAIT
,
NULL
);
pipe
=
CreateNamedPipe
A
(
WINE_TEST_PIPE
,
PIPE_ACCESS_DUPLEX
|
FILE_FLAG_FIRST_PIPE_INSTANCE
,
PIPE_TYPE_BYTE
|
PIPE_NOWAIT
,
PIPE_UNLIMITED_INSTANCES
,
0
,
0
,
NMPWAIT_USE_DEFAULT_WAIT
,
NULL
);
ok
(
pipe
!=
INVALID_HANDLE_VALUE
,
"CreateNamedPipe error %d
\n
"
,
GetLastError
());
test_default_handle_security
(
token
,
pipe
,
&
mapping
);
SetLastError
(
0xdeadbeef
);
file
=
CreateFile
(
WINE_TEST_PIPE
,
FILE_ALL_ACCESS
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
file
=
CreateFile
A
(
WINE_TEST_PIPE
,
FILE_ALL_ACCESS
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFile error %d
\n
"
,
GetLastError
());
CloseHandle
(
file
);
CloseHandle
(
pipe
);
SetLastError
(
0xdeadbeef
);
file
=
CreateFile
(
"
\\\\
.
\\
pipe
\\
"
,
FILE_ALL_ACCESS
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
file
=
CreateFile
A
(
"
\\\\
.
\\
pipe
\\
"
,
FILE_ALL_ACCESS
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
file
!=
INVALID_HANDLE_VALUE
||
broken
(
file
==
INVALID_HANDLE_VALUE
)
/* before Vista */
,
"CreateFile error %d
\n
"
,
GetLastError
());
CloseHandle
(
file
);
}
...
...
@@ -4609,7 +4609,7 @@ static void test_default_dacl_owner_sid(void)
sa
.
nLength
=
sizeof
(
SECURITY_ATTRIBUTES
);
sa
.
lpSecurityDescriptor
=
sd
;
sa
.
bInheritHandle
=
FALSE
;
handle
=
CreateEvent
(
&
sa
,
TRUE
,
TRUE
,
"test_event"
);
handle
=
CreateEvent
A
(
&
sa
,
TRUE
,
TRUE
,
"test_event"
);
ok
(
handle
!=
NULL
,
"error %u
\n
"
,
GetLastError
()
);
size
=
0
;
...
...
dlls/advapi32/tests/service.c
View file @
f6b2aa4a
...
...
@@ -166,7 +166,7 @@ static void test_open_svc(void)
/* Try to open the service with this displayname, unless the displayname equals
* the servicename as that would defeat the purpose of this test.
*/
if
(
!
lstrcmpi
(
spooler
,
displayname
))
if
(
!
lstrcmpi
A
(
spooler
,
displayname
))
{
skip
(
"displayname equals servicename
\n
"
);
CloseServiceHandle
(
scm_handle
);
...
...
@@ -701,7 +701,7 @@ static void test_get_displayname(void)
SetLastError
(
0xdeadbeef
);
ret
=
GetServiceDisplayNameA
(
scm_handle
,
servicename
,
displayname
,
&
displaysize
);
ok
(
ret
,
"Expected success, got error %u
\n
"
,
GetLastError
());
ok
(
!
lstrcmpi
(
displayname
,
servicename
),
ok
(
!
lstrcmpi
A
(
displayname
,
servicename
),
"Expected displayname to be %s, got %s
\n
"
,
servicename
,
displayname
);
/* Delete the service */
...
...
@@ -869,7 +869,7 @@ static void test_get_servicekeyname(void)
{
ok
(
strlen
(
servicename
)
==
tempsize
/
2
,
"Expected the buffer to be twice the length of the string
\n
"
)
;
ok
(
!
lstrcmpi
(
servicename
,
spooler
),
"Expected %s, got %s
\n
"
,
spooler
,
servicename
);
ok
(
!
lstrcmpi
A
(
servicename
,
spooler
),
"Expected %s, got %s
\n
"
,
spooler
,
servicename
);
ok
(
servicesize
==
(
tempsize
*
2
),
"Expected servicesize not to change if buffer not insufficient
\n
"
)
;
}
...
...
@@ -1057,9 +1057,9 @@ static void test_enum_svc(void)
DWORD
neededW
,
returnedW
;
DWORD
tempneeded
,
tempreturned
,
missing
;
DWORD
servicecountactive
,
servicecountinactive
;
ENUM_SERVICE_STATUS
*
services
;
ENUM_SERVICE_STATUS
A
*
services
;
ENUM_SERVICE_STATUSW
*
servicesW
;
ENUM_SERVICE_STATUS_PROCESS
*
exservices
;
ENUM_SERVICE_STATUS_PROCESS
A
*
exservices
;
UINT
i
;
/* All NULL or wrong */
...
...
@@ -1289,7 +1289,7 @@ static void test_enum_svc(void)
/* Allocate less than the needed bytes and don't specify a resume handle */
services
=
HeapAlloc
(
GetProcessHeap
(),
0
,
tempneeded
);
bufsize
=
(
tempreturned
-
1
)
*
sizeof
(
ENUM_SERVICE_STATUS
);
bufsize
=
(
tempreturned
-
1
)
*
sizeof
(
ENUM_SERVICE_STATUS
A
);
needed
=
0xdeadbeef
;
returned
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
...
...
@@ -1302,7 +1302,7 @@ static void test_enum_svc(void)
"Expected ERROR_MORE_DATA, got %d
\n
"
,
GetLastError
());
/* Allocate less than the needed bytes, this time with a correct resume handle */
bufsize
=
(
tempreturned
-
1
)
*
sizeof
(
ENUM_SERVICE_STATUS
);
bufsize
=
(
tempreturned
-
1
)
*
sizeof
(
ENUM_SERVICE_STATUS
A
);
needed
=
0xdeadbeef
;
returned
=
0xdeadbeef
;
resume
=
0
;
...
...
@@ -1604,7 +1604,7 @@ static void test_enum_svc(void)
/* Allocate less than the needed bytes and don't specify a resume handle */
exservices
=
HeapAlloc
(
GetProcessHeap
(),
0
,
tempneeded
);
bufsize
=
(
tempreturned
-
1
)
*
sizeof
(
ENUM_SERVICE_STATUS
);
bufsize
=
(
tempreturned
-
1
)
*
sizeof
(
ENUM_SERVICE_STATUS
A
);
needed
=
0xdeadbeef
;
returned
=
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
...
...
@@ -1617,7 +1617,7 @@ static void test_enum_svc(void)
"Expected ERROR_MORE_DATA, got %d
\n
"
,
GetLastError
());
/* Allocate less than the needed bytes, this time with a correct resume handle */
bufsize
=
(
tempreturned
-
1
)
*
sizeof
(
ENUM_SERVICE_STATUS
);
bufsize
=
(
tempreturned
-
1
)
*
sizeof
(
ENUM_SERVICE_STATUS
A
);
needed
=
0xdeadbeef
;
returned
=
0xdeadbeef
;
resume
=
0
;
...
...
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