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
af069ad7
Commit
af069ad7
authored
Oct 24, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
Oct 25, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
credui: Implement CredUIConfirmCredentialsW.
parent
d275a4d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
127 additions
and
12 deletions
+127
-12
credui_main.c
dlls/credui/credui_main.c
+127
-12
No files found.
dlls/credui/credui_main.c
View file @
af069ad7
...
...
@@ -30,24 +30,65 @@
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
credui
);
struct
pending_credentials
{
struct
list
entry
;
PWSTR
pszTargetName
;
PWSTR
pszUsername
;
PWSTR
pszPassword
;
};
static
HINSTANCE
hinstCredUI
;
struct
list
pending_credentials_list
=
LIST_INIT
(
pending_credentials_list
);
static
CRITICAL_SECTION
csPendingCredentials
;
static
CRITICAL_SECTION_DEBUG
critsect_debug
=
{
0
,
0
,
&
csPendingCredentials
,
{
&
critsect_debug
.
ProcessLocksList
,
&
critsect_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": csPendingCredentials"
)
}
};
static
CRITICAL_SECTION
csPendingCredentials
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
BOOL
WINAPI
DllMain
(
HINSTANCE
hinstDLL
,
DWORD
fdwReason
,
LPVOID
lpvReserved
)
{
TRACE
(
"(0x%p, %d, %p)
\n
"
,
hinstDLL
,
fdwReason
,
lpvReserved
);
TRACE
(
"(0x%p, %d, %p)
\n
"
,
hinstDLL
,
fdwReason
,
lpvReserved
);
if
(
fdwReason
==
DLL_WINE_PREATTACH
)
return
FALSE
;
/* prefer native version */
if
(
fdwReason
==
DLL_PROCESS_ATTACH
)
{
DisableThreadLibraryCalls
(
hinstDLL
);
hinstCredUI
=
hinstDLL
;
}
else
if
(
fdwReason
==
DLL_PROCESS_DETACH
)
{
struct
pending_credentials
*
entry
,
*
cursor2
;
LIST_FOR_EACH_ENTRY_SAFE
(
entry
,
cursor2
,
&
pending_credentials_list
,
struct
pending_credentials
,
entry
)
{
list_remove
(
&
entry
->
entry
);
if
(
fdwReason
==
DLL_WINE_PREATTACH
)
return
FALSE
;
/* prefer native version */
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
pszTargetName
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
pszUsername
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
pszPassword
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
}
}
if
(
fdwReason
==
DLL_PROCESS_ATTACH
)
{
DisableThreadLibraryCalls
(
hinstDLL
);
hinstCredUI
=
hinstDLL
;
}
return
TRUE
;
}
return
TRUE
;
static
DWORD
save_credentials
(
PCWSTR
pszTargetName
,
PCWSTR
pszUsername
,
PCWSTR
pszPassword
)
{
FIXME
(
"save servername %s with username %s
\n
"
,
debugstr_w
(
pszTargetName
),
debugstr_w
(
pszUsername
));
return
ERROR_SUCCESS
;
}
struct
cred_dialog_params
...
...
@@ -145,6 +186,7 @@ DWORD WINAPI CredUIPromptForCredentialsW(PCREDUI_INFOW pUIInfo,
{
INT_PTR
ret
;
struct
cred_dialog_params
params
;
DWORD
result
=
ERROR_SUCCESS
;
TRACE
(
"(%p, %s, %p, %d, %s, %d, %p, %d, %p, 0x%08x)
\n
"
,
pUIInfo
,
debugstr_w
(
pszTargetName
),
Reserved
,
dwAuthError
,
debugstr_w
(
pszUsername
),
...
...
@@ -183,7 +225,50 @@ DWORD WINAPI CredUIPromptForCredentialsW(PCREDUI_INFOW pUIInfo,
if
(
pfSave
)
*
pfSave
=
params
.
fSave
;
return
ERROR_SUCCESS
;
if
(
params
.
fSave
)
{
if
(
dwFlags
&
CREDUI_FLAGS_EXPECT_CONFIRMATION
)
{
BOOL
found
=
FALSE
;
struct
pending_credentials
*
entry
;
int
len
;
EnterCriticalSection
(
&
csPendingCredentials
);
/* find existing pending credentials for the same target and overwrite */
/* FIXME: is this correct? */
LIST_FOR_EACH_ENTRY
(
entry
,
&
pending_credentials_list
,
struct
pending_credentials
,
entry
)
if
(
!
strcmpW
(
pszTargetName
,
entry
->
pszTargetName
))
{
found
=
TRUE
;
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
pszUsername
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
pszPassword
);
}
if
(
!
found
)
{
entry
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
entry
));
list_init
(
&
entry
->
entry
);
len
=
strlenW
(
pszTargetName
);
entry
->
pszTargetName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
memcpy
(
entry
->
pszTargetName
,
pszTargetName
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
list_add_tail
(
&
entry
->
entry
,
&
pending_credentials_list
);
}
len
=
strlenW
(
params
.
pszUsername
);
entry
->
pszUsername
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
memcpy
(
entry
->
pszUsername
,
params
.
pszUsername
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
len
=
strlenW
(
params
.
pszPassword
);
entry
->
pszPassword
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
memcpy
(
entry
->
pszPassword
,
params
.
pszPassword
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
LeaveCriticalSection
(
&
csPendingCredentials
);
}
else
result
=
save_credentials
(
pszTargetName
,
pszUsername
,
pszPassword
);
}
return
result
;
}
/******************************************************************************
...
...
@@ -191,9 +276,39 @@ DWORD WINAPI CredUIPromptForCredentialsW(PCREDUI_INFOW pUIInfo,
*/
DWORD
WINAPI
CredUIConfirmCredentialsW
(
PCWSTR
pszTargetName
,
BOOL
bConfirm
)
{
FIXME
(
"(%s, %s): stub
\n
"
,
debugstr_w
(
pszTargetName
),
bConfirm
?
"TRUE"
:
"FALSE"
);
return
ERROR_SUCCESS
;
struct
pending_credentials
*
entry
;
DWORD
result
=
ERROR_NOT_FOUND
;
TRACE
(
"(%s, %s)
\n
"
,
debugstr_w
(
pszTargetName
),
bConfirm
?
"TRUE"
:
"FALSE"
);
if
(
!
pszTargetName
)
return
ERROR_INVALID_PARAMETER
;
EnterCriticalSection
(
&
csPendingCredentials
);
LIST_FOR_EACH_ENTRY
(
entry
,
&
pending_credentials_list
,
struct
pending_credentials
,
entry
)
{
if
(
!
strcmpW
(
pszTargetName
,
entry
->
pszTargetName
))
{
if
(
bConfirm
)
result
=
save_credentials
(
entry
->
pszTargetName
,
entry
->
pszUsername
,
entry
->
pszPassword
);
else
result
=
ERROR_SUCCESS
;
list_remove
(
&
entry
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
pszTargetName
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
pszUsername
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
->
pszPassword
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
break
;
}
}
LeaveCriticalSection
(
&
csPendingCredentials
);
return
result
;
}
/******************************************************************************
...
...
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