42#define TEST_TARGET_NAME "credtest.winehq.org"
43#define TEST_TARGET_NAME2 "credtest2.winehq.org"
54 "CredReadA should have failed with ERROR_INVALID_PARAMETER instead of %d\n",
60 "CredReadA should have failed with ERROR_INVALID_FLAGS or ERROR_INVALID_PARAMETER instead of %d\n",
66 "CredReadA should have failed with ERROR_INVALID_PARAMETER instead of %d\n",
78 "CredWriteA should have failed with ERROR_INVALID_PARAMETER instead of %d\n",
84 new_cred.
Comment = (
char *)
"Comment";
86 new_cred.CredentialBlob =
NULL;
91 new_cred.
UserName = (
char *)
"winetest";
94 ret = pCredWriteA(&new_cred, 0);
96 "CredWriteA should have failed with ERROR_INVALID_PARAMETER instead of %d\n",
103 ret = pCredWriteA(&new_cred, 0);
114 "CredWrite with username without domain should return ERROR_BAD_USERNAME"
115 "or ERROR_NO_SUCH_LOGON_SESSION not %d\n",
GetLastError());
120 ret = pCredWriteA(&new_cred, 0);
122 "CredWriteA with NULL username should have failed with ERROR_BAD_USERNAME instead of %d\n",
125 new_cred.
UserName = (
char *)
"winetest";
128 ret = pCredWriteA(&new_cred, 0);
137 ret = pCredWriteA(&new_cred, 0);
145 ret = pCredWriteA(&new_cred, 0);
153 ret = pCredWriteA(&new_cred, 0);
162 ret = pCredWriteA(&new_cred, 0);
163 ok(!
ret,
"CredWriteA succeeded\n");
174 "CredDeleteA should have failed with ERROR_INVALID_PARAMETER instead of %d\n",
180 "CredDeleteA should have failed with ERROR_INVALID_FLAGS or ERROR_INVALID_PARAMETER instead of %d\n",
187 char target_name[] =
"no_such_target";
192 if (!pCredReadDomainCredentialsA)
194 win_skip(
"CredReadDomainCredentialsA() is not implemented\n");
202 ret = pCredReadDomainCredentialsA(&
info, 0,
NULL, &creds);
209 ret = pCredReadDomainCredentialsA(
NULL, 0, &
count, &creds);
211 "CredReadDomainCredentialsA should have failed with ERROR_INVALID_PARAMETER instead of %d\n",
215 creds = (
void*)0x12345;
217 ret = pCredReadDomainCredentialsA(&
info, 0, &
count, &creds);
219 "CredReadDomainCredentialsA should have failed with ERROR_NOT_FOUND instead of %d\n",
221 ok(
count ==0 && creds ==
NULL,
"CredReadDomainCredentialsA must not return any result\n");
226 ret = pCredReadDomainCredentialsA(&
info, 0, &
count, &creds);
227 ok(!
ret,
"CredReadDomainCredentialsA should have failed\n");
230 "Expected ERROR_NOT_FOUND or ERROR_INVALID_PARAMETER instead of %d\n",
236 ret = pCredReadDomainCredentialsA(&
info, 0, &
count, &creds);
237 ok(!
ret,
"CredReadDomainCredentialsA should have failed\n");
240 "Expected ERROR_NOT_FOUND or ERROR_INVALID_PARAMETER instead of %d\n",
251 ok_(__FILE__,
line)(!cred->CredentialBlob,
"expected NULL credentials but got %p\n", cred->CredentialBlob);
257 ok_(__FILE__,
line)(cred->CredentialBlob !=
NULL,
"CredentialBlob should be present\n");
258 if (cred->CredentialBlob)
275 new_cred.
Comment = (
char *)
"Comment";
282 new_cred.
UserName = (
char *)
"winetest";
284 ret = pCredWriteA(&new_cred, 0);
289 skip(
"couldn't write generic credentials, skipping tests\n");
302 "expected creds[%d]->Type CRED_TYPE_GENERIC or CRED_TYPE_DOMAIN_PASSWORD but got %d\n",
i, creds[
i]->
Type);
303 ok(!creds[
i]->
Flags,
"expected creds[%d]->Flags 0 but got 0x%x\n",
i, creds[
i]->
Flags);
304 ok(!
strcmp(creds[
i]->
Comment,
"Comment"),
"expected creds[%d]->Comment \"Comment\" but got \"%s\"\n",
i, creds[
i]->
Comment);
306 ok(creds[
i]->
Persist,
"expected creds[%d]->Persist CRED_PERSIST_ENTERPRISE but got %d\n",
i, creds[
i]->
Persist);
307 ok(!
strcmp(creds[
i]->UserName,
"winetest"),
"expected creds[%d]->UserName \"winetest\" but got \"%s\"\n",
i, creds[
i]->UserName);
312 ok(found,
"credentials not found\n");
332 new_cred.
Type = cred_type;
334 new_cred.
Comment = (
char *)
"Comment";
341 new_cred.
UserName = (
char *)
"test\\winetest";
342 ret = pCredWriteA(&new_cred, 0);
345 skip(
"CRED_TYPE_DOMAIN_PASSWORD credentials are not supported "
346 "or are disabled. Skipping\n");
358 ok(creds[
i]->
Type == cred_type,
"expected creds[%d]->Type CRED_TYPE_DOMAIN_PASSWORD but got %d\n",
i, creds[
i]->
Type);
359 ok(!creds[
i]->
Flags,
"expected creds[%d]->Flags 0 but got 0x%x\n",
i, creds[
i]->
Flags);
360 ok(!
strcmp(creds[
i]->
Comment,
"Comment"),
"expected creds[%d]->Comment \"Comment\" but got \"%s\"\n",
i, creds[
i]->
Comment);
362 ok(creds[
i]->
Persist,
"expected creds[%d]->Persist CRED_PERSIST_ENTERPRISE but got %d\n",
i, creds[
i]->
Persist);
363 ok(!
strcmp(creds[
i]->UserName,
"test\\winetest"),
"expected creds[%d]->UserName \"winetest\" but got \"%s\"\n",
i, creds[
i]->UserName);
368 ok(found,
"credentials not found\n");
385 static WCHAR tW[] = {
't',0};
386 static WCHAR teW[] = {
't',
'e',0};
387 static WCHAR tesW[] = {
't',
'e',
's',0};
389 static WCHAR test1W[] = {
't',
'e',
's',
't',
'1',0};
399 ok( !
ret,
"unexpected success\n" );
407 ok( !
ret,
"unexpected success\n" );
410 str = (
char *)0xdeadbeef;
412 ret = pCredMarshalCredentialA( 0, &
cert, &
str );
414 ok( !
ret,
"unexpected success\n" );
416 ok(
str == (
char *)0xdeadbeef,
"got %p\n",
str );
421 ok( !
ret,
"unexpected success\n" );
428 ok( !
ret,
"unexpected success\n" );
433 str = (
char *)0xdeadbeef;
437 ok( !
ret,
"unexpected success\n" );
439 ok(
str == (
char *)0xdeadbeef,
"got %p\n",
str );
450 cert.rgbHashOfCert[0] = 2;
458 cert.rgbHashOfCert[0] = 255;
466 cert.rgbHashOfCert[0] = 1;
467 cert.rgbHashOfCert[1] = 1;
475 cert.rgbHashOfCert[0] = 1;
476 cert.rgbHashOfCert[1] = 1;
477 cert.rgbHashOfCert[2] = 1;
486 cert.rgbHashOfCert[0] =
'W';
487 cert.rgbHashOfCert[1] =
'i';
488 cert.rgbHashOfCert[2] =
'n';
489 cert.rgbHashOfCert[3] =
'e';
506 str = (
char *)0xdeadbeef;
510 ok( !
ret,
"unexpected success\n" );
512 ok(
str == (
char *)0xdeadbeef,
"got %p\n",
str );
515 str = (
char *)0xdeadbeef;
519 ok( !
ret,
"unexpected success\n" );
521 ok(
str == (
char *)0xdeadbeef,
"got %p\n",
str );
568 static const WCHAR tW[] = {
't',0};
569 static const WCHAR teW[] = {
't',
'e',0};
570 static const WCHAR tesW[] = {
't',
'e',
's',0};
571 static const WCHAR testW[] = {
't',
'e',
's',
't',0};
583 const void *unmarshaled;
629 ok( !
ret,
"unexpected success\n" );
636 ok( !
ret,
"unexpected success\n" );
644 ok( !
ret,
"unexpected success\n" );
649 ret = pCredUnmarshalCredentialA(
"@@BAAAAAAAAAAAAAAAAAAAAAAAAAAA", &
type,
NULL );
651 ok( !
ret,
"unexpected success\n" );
655 ret = pCredUnmarshalCredentialA(
"@@BAAAAAAAAAAAAAAAAAAAAAAAAAAA",
NULL, (
void **)&
cert );
657 ok( !
ret,
"unexpected success\n" );
672 ok(
p !=
NULL,
"[%u] returned pointer is NULL\n",
i);
678 "[%u] wrong size %u\n",
i,
cert->cbSize);
679 for (
j = 0;
j <
sizeof(
cert->rgbHashOfCert);
j++)
680 ok(
cert->rgbHashOfCert[
j] ==
hash[
j],
"[%u] wrong data\n",
i);
692 ok(!
ret,
"[%u] unexpected success\n",
i);
695 ok(
p ==
NULL,
"[%u] returned pointer is not NULL\n",
i);
709 const char *
ptr[] = {
711 "@@BXlmblBAAAAAAAAAAAAAAAAAAAAA",
712 "@@BAAAAAAAAAAAAAAAAAAAAAAAAAAA",
716 "@@CIAAAAA0BQZAMHA0BA",
732 "@@BAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
733 "@@BAAAAAAAAAAAAAAAAAAAAAAAAAA",
734 "@@BAAAAAAAAAAAAAAAAAAAAAAAAAA+",
735 "@@BAAAAAAAAAAAAAAAAAAAAAAAAAA:",
736 "@@BAAAAAAAAAAAAAAAAAAAAAAAAAA>",
737 "@@BAAAAAAAAAAAAAAAAAAAAAAAAAA<",
753 res = pCredIsMarshaledCredentialA(
ptr[
i]);
776 pCredReadDomainCredentialsA = (
void *)
GetProcAddress(
mod,
"CredReadDomainCredentialsA");
778 pCredUnmarshalCredentialA = (
void *)
GetProcAddress(
mod,
"CredUnmarshalCredentialA");
779 pCredIsMarshaledCredentialA = (
void *)
GetProcAddress(
mod,
"CredIsMarshaledCredentialA");
781 if (!pCredEnumerateA || !pCredFree || !pCredWriteA || !pCredDeleteA || !pCredReadA)
783 win_skip(
"credentials functions not present in advapi32.dll\n");
787 if (pCredGetSessionTypes)
793 ok(persists[0] ==
CRED_PERSIST_NONE,
"persists[0] = %u instead of CRED_PERSIST_NONE\n", persists[0]);
808 skip(
"CRED_TYPE_GENERIC credentials are not supported or are disabled. Skipping\n");
812 trace(
"domain password:\n");
814 skip(
"CRED_TYPE_DOMAIN_PASSWORD credentials are not supported or are disabled. Skipping\n");
818 trace(
"domain visible password:\n");
820 skip(
"CRED_TYPE_DOMAIN_VISIBLE_PASSWORD credentials are not supported or are disabled. Skipping\n");
std::map< E_MODULE, HMODULE > mod
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define ERROR_INVALID_PARAMETER
#define GetProcAddress(x, y)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
static const WCHAR emptyW[]
static const WCHAR testW[]
static struct test_info tests[]
static void test_CredUnmarshalCredentialA(void)
static DWORD PCREDENTIALA **static PVOID
static void test_CredWriteA(void)
static void test_CredMarshalCredentialA(void)
static void check_blob(int line, DWORD cred_type, PCREDENTIALA cred)
static void test_CredReadA(void)
static void test_CredReadDomainCredentialsA(void)
static void test_domain_password(DWORD cred_type)
static void test_CredIsMarshaledCredentialA(void)
static DWORD PCREDENTIALA **static LPSTR *static PCRED_MARSHAL_TYPE
static const WCHAR TEST_PASSWORD[]
static void test_CredDeleteA(void)
static PCREDENTIALA *static LPCSTR
static void test_generic(void)
PCREDENTIAL_ATTRIBUTEA Attributes
DWORD WINAPI GetLastError(void)
#define CRED_TYPE_MAXIMUM
#define CRED_PERSIST_SESSION
enum _CRED_MARSHAL_TYPE CRED_MARSHAL_TYPE
struct _CREDENTIAL_TARGET_INFORMATIONA * PCREDENTIAL_TARGET_INFORMATIONA
#define CRED_PERSIST_ENTERPRISE
#define CRED_TYPE_DOMAIN_VISIBLE_PASSWORD
#define CRED_PERSIST_LOCAL_MACHINE
struct _CREDENTIALA * PCREDENTIALA
#define CRED_TYPE_DOMAIN_PASSWORD
@ UsernameTargetCredential
#define CRED_TYPE_GENERIC
#define CRED_PERSIST_NONE
#define ERROR_BAD_USERNAME
#define ERROR_NO_SUCH_LOGON_SESSION
#define ERROR_INVALID_FLAGS
_Must_inspect_result_ _In_ ULONG Flags