Changeset 32431 in vbox for trunk/src/VBox/Additions/WINNT/VBoxCredProv
- Timestamp:
- Sep 11, 2010 6:02:17 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 65796
- Location:
- trunk/src/VBox/Additions/WINNT/VBoxCredProv
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredProv.cpp
r30252 r32431 69 69 70 70 71 /* 71 /* 72 72 * SetUsageScenario is the provider's cue that it's going to be asked for tiles 73 73 * in a subsequent call. This call happens after the user pressed CTRL+ALT+DEL 74 * and we need to handle the CPUS_LOGON event. 74 * and we need to handle the CPUS_LOGON event. 75 75 */ 76 76 HRESULT VBoxCredProv::SetUsageScenario(CREDENTIAL_PROVIDER_USAGE_SCENARIO cpUsageScenario, … … 105 105 { 106 106 hr = m_pCred->Initialize(m_cpUsageScenario, 107 s_rgCredProvFieldDescriptors, 107 s_rgCredProvFieldDescriptors, 108 108 s_rgFieldStatePairs); 109 109 } … … 134 134 case CPUS_CREDUI: 135 135 case CPUS_PLAP: 136 136 137 137 hr = E_NOTIMPL; 138 138 break; … … 149 149 150 150 151 /* 151 /* 152 152 * SetSerialization takes the kind of buffer that you would normally return to LogonUI for 153 153 * an authentication attempt. It's the opposite of ICredentialProviderCredential::GetSerialization. … … 168 168 169 169 170 /* 170 /* 171 171 * Called by LogonUI to give you a callback. Providers often use the callback if they 172 172 * some event would cause them to need to change the set of tiles (visible UI elements) 173 * that they enumerated. 173 * that they enumerated. 174 174 */ 175 175 HRESULT VBoxCredProv::Advise(ICredentialProviderEvents *pcpEvents, … … 187 187 /* 188 188 * Save advice context for later use when binding to 189 * certain ICredentialProviderEvents events. 189 * certain ICredentialProviderEvents events. 190 190 */ 191 191 m_upAdviseContext = upAdviseContext; … … 199 199 Log(("VBoxCredProv::UnAdvise\n")); 200 200 if (m_pCredProvEvents != NULL) 201 { 201 { 202 202 m_pCredProvEvents->Release(); 203 203 m_pCredProvEvents = NULL; … … 208 208 209 209 210 /* 210 /* 211 211 * Called by LogonUI to determine the number of fields in your tiles. This 212 212 * does mean that all your tiles must have the same number of fields. … … 248 248 249 249 250 /* 250 /* 251 251 * Sets pdwCount to the number of tiles that we wish to show at this time. 252 252 * Sets pdwDefault to the index of the tile which should be used as the default. … … 317 317 && ppCredProvCredential) 318 318 { 319 hr = m_pCred->QueryInterface(IID_ICredentialProviderCredential, 319 hr = m_pCred->QueryInterface(IID_ICredentialProviderCredential, 320 320 reinterpret_cast<void**>(ppCredProvCredential)); 321 321 } -
trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredProv.h
r30252 r32431 91 91 92 92 /** Interface reference count. */ 93 LONG m_cRef; 93 LONG m_cRef; 94 94 /** Our one and only credential. */ 95 VBoxCredential *m_pCred; 96 /** Poller thread for credential lookup. */ 95 VBoxCredential *m_pCred; 96 /** Poller thread for credential lookup. */ 97 97 VBoxCredPoller *m_pPoller; 98 98 /** Used to tell our owner to re-enumerate credentials. */ 99 99 ICredentialProviderEvents *m_pCredProvEvents; 100 /** Used to tell our owner who we are when asking to re-enumerate credentials. */ 100 /** Used to tell our owner who we are when asking to re-enumerate credentials. */ 101 101 UINT_PTR m_upAdviseContext; 102 102 /** Saved usage scenario. */ -
trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredential.cpp
r30367 r32431 105 105 PWSTR *ppwszStored; 106 106 107 /* 107 /* 108 108 * Update domain name (can be NULL) and will 109 109 * be later replaced by the local computer name in the … … 138 138 else 139 139 { 140 /* 141 * Oky, no display name, but mabye it's a 140 /* 141 * Oky, no display name, but mabye it's a 142 142 * principal name from which we have to extract the 143 143 * domain from? ([email protected] -> jdoe in … … 175 175 176 176 177 /* 177 /* 178 178 * Initializes one credential with the field information passed in. 179 179 * Set the value of the SFI_USERNAME field to pwzUsername. … … 190 190 m_cpUS = cpus; 191 191 192 /* 192 /* 193 193 * Copy the field descriptors for each field. This is useful if you want to vary the 194 * field descriptors based on what Usage scenario the credential was created for. 194 * field descriptors based on what Usage scenario the credential was created for. 195 195 */ 196 196 for (DWORD i = 0; SUCCEEDED(hr) && i < ARRAYSIZE(m_rgCredProvFieldDescriptors); i++) … … 207 207 208 208 209 /* 209 /* 210 210 * LogonUI calls this in order to give us a callback in case we need to notify it of anything. 211 * Store this callback pointer for later use. 211 * Store this callback pointer for later use. 212 212 */ 213 213 HRESULT VBoxCredential::Advise(ICredentialProviderCredentialEvents* pcpce) … … 230 230 /* 231 231 * We're done with the current iteration, trigger a refresh of ourselves 232 * to reset credentials and to keep the logon UI clean (no stale entries anymore). 232 * to reset credentials and to keep the logon UI clean (no stale entries anymore). 233 233 */ 234 234 Reset(); 235 235 236 /* 236 /* 237 237 * Force a re-iteration of the provider (which will give zero credentials 238 * to try out because we just resetted our one and only a line above. 238 * to try out because we just resetted our one and only a line above. 239 239 */ 240 240 if (m_pProvider) … … 260 260 Log(("VBoxCredential::SetSelected\n")); 261 261 262 /* 262 /* 263 263 * Don't do auto logon here because it would retry too often with 264 264 * every credential field (user name, password, domain, ...) which makes … … 363 363 &dwTotalEntries, 364 364 &dwResumeHandle); 365 if ( (nStatus == NERR_Success) 365 if ( (nStatus == NERR_Success) 366 366 || (nStatus == ERROR_MORE_DATA)) 367 367 { … … 370 370 for (DWORD i = 0; i < dwEntriesRead; i++) 371 371 { 372 /* 373 * Search for the "display name" - that might be 372 /* 373 * Search for the "display name" - that might be 374 374 * "John Doe" or something similar the user recognizes easier 375 375 * and may not the same as the "account" name (e.g. "jdoe"). 376 376 */ 377 if ( pCurBuf 377 if ( pCurBuf 378 378 && pCurBuf->usri2_full_name 379 379 && StrCmpI(pwszDisplayName, pCurBuf->usri2_full_name) == 0) 380 380 { 381 /* 382 * Copy the real user name (e.g. "jdoe") to our 381 /* 382 * Copy the real user name (e.g. "jdoe") to our 383 383 * output buffer. 384 384 */ … … 411 411 } 412 412 413 Log(("VBoxCredential::TranslateAccountName: Returned nStatus=%ld, fFound=%s\n", 413 Log(("VBoxCredential::TranslateAccountName: Returned nStatus=%ld, fFound=%s\n", 414 414 nStatus, fFound ? "Yes" : "No")); 415 415 return fFound; … … 427 427 if (TranslateNameW(pwszName, NameUnknown, NameUserPrincipal, ppwszAccoutName, &cbLen)) 428 428 { 429 Log(("VBoxCredential::GetAccountName: Real ADS account name of '%ls' is '%ls'\n", 429 Log(("VBoxCredential::GetAccountName: Real ADS account name of '%ls' is '%ls'\n", 430 430 pwszName, ppwszAccoutName)); 431 431 } … … 442 442 { 443 443 dwErr = NO_ERROR; 444 444 445 445 } 446 446 #endif … … 514 514 /* Check to make sure dwFieldID is a legitimate index. */ 515 515 HRESULT hr; 516 if ( dwFieldID < ARRAYSIZE(m_rgCredProvFieldDescriptors) 516 if ( dwFieldID < ARRAYSIZE(m_rgCredProvFieldDescriptors) 517 517 && ppwszString) 518 518 { … … 524 524 525 525 /* 526 * Make a copy of the string and return that, the caller is responsible for freeing it. 526 * Make a copy of the string and return that, the caller is responsible for freeing it. 527 527 * Note that there can be empty fields (like a missing domain name); handle them 528 528 * by writing an empty string. … … 570 570 571 571 572 /* 572 /* 573 573 * Sets the value of a field which can accept a string as a value. 574 574 * This is called on each keystroke when a user types into an edit field. … … 577 577 PCWSTR pcwzString) 578 578 { 579 Log(("VBoxCredential::SetStringValue: dwFieldID=%ld, pcwzString=%ls\n", 579 Log(("VBoxCredential::SetStringValue: dwFieldID=%ld, pcwzString=%ls\n", 580 580 dwFieldID, pcwzString)); 581 581 … … 589 589 /* Validate parameters. */ 590 590 if ( dwFieldID < ARRAYSIZE(m_rgCredProvFieldDescriptors) 591 && ( CPFT_EDIT_TEXT == m_rgCredProvFieldDescriptors[dwFieldID].cpft 591 && ( CPFT_EDIT_TEXT == m_rgCredProvFieldDescriptors[dwFieldID].cpft 592 592 || CPFT_PASSWORD_TEXT == m_rgCredProvFieldDescriptors[dwFieldID].cpft)) 593 593 { … … 709 709 hr = UnicodeStringInitWithString(wszComputerName, &kil.LogonDomainName); 710 710 else 711 hr = UnicodeStringInitWithString(m_rgFieldStrings [SFI_DOMAINNAME], 711 hr = UnicodeStringInitWithString(m_rgFieldStrings [SFI_DOMAINNAME], 712 712 &kil.LogonDomainName); 713 713 … … 723 723 /* Allocate copies of, and package, the strings in a binary blob. */ 724 724 kil.MessageType = KerbInteractiveLogon; 725 hr = KerbInteractiveLogonPack(kil, 726 &pcpCredentialSerialization->rgbSerialization, 725 hr = KerbInteractiveLogonPack(kil, 726 &pcpCredentialSerialization->rgbSerialization, 727 727 &pcpCredentialSerialization->cbSerialization); 728 728 if (SUCCEEDED(hr)) … … 739 739 * By setting this to CPGSR_RETURN_CREDENTIAL_FINISHED we are letting logonUI know 740 740 * that we have all the information we need and it should attempt to submit the 741 * serialized credential. 741 * serialized credential. 742 742 */ 743 743 *pcpGetSerializationResponse = CPGSR_RETURN_CREDENTIAL_FINISHED; … … 759 759 760 760 761 /* 761 /* 762 762 * ReportResult is completely optional. Its purpose is to allow a credential to customize the string 763 763 * and the icon displayed in the case of a logon failure. For example, we have chosen to -
trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredential.h
r30367 r32431 124 124 LONG m_cRef; 125 125 /** The usage scenario for which we were enumerated. */ 126 CREDENTIAL_PROVIDER_USAGE_SCENARIO m_cpUS; 126 CREDENTIAL_PROVIDER_USAGE_SCENARIO m_cpUS; 127 127 /** Holding type and name of each field in the tile. */ 128 128 CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR m_rgCredProvFieldDescriptors[SFI_NUM_FIELDS]; 129 129 /** Holding state of each field in the tile. */ 130 FIELD_STATE_PAIR m_rgFieldStatePairs[SFI_NUM_FIELDS]; 130 FIELD_STATE_PAIR m_rgFieldStatePairs[SFI_NUM_FIELDS]; 131 131 /** Holding string value of each field. This is different from the name of 132 132 the field held in m_rgCredProvFieldDescriptors. */ 133 PWSTR m_rgFieldStrings[SFI_NUM_FIELDS]; 133 PWSTR m_rgFieldStrings[SFI_NUM_FIELDS]; 134 134 ICredentialProviderCredentialEvents *m_pCredProvCredentialEvents; 135 135
Note:
See TracChangeset
for help on using the changeset viewer.