]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.c
Update for SecurityPkg.
[mirror_edk2.git] / SecurityPkg / UserIdentification / UserProfileManagerDxe / UserProfileManager.c
1 /** @file
2 This driver is a configuration tool for adding, deleting or modifying user
3 profiles, including gathering the necessary information to ascertain their
4 identity in the future, updating user access policy and identification
5 policy, etc.
6
7 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 #include "UserProfileManager.h"
19
20 EFI_USER_MANAGER_PROTOCOL *mUserManager = NULL;
21 CREDENTIAL_PROVIDER_INFO *mProviderInfo = NULL;
22 UINT8 mProviderChoice;
23 UINT8 mConncetLogical;
24 USER_INFO_ACCESS mAccessInfo;
25 USER_INFO mUserInfo;
26 USER_PROFILE_MANAGER_CALLBACK_INFO *mCallbackInfo;
27 HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = {
28 {
29 {
30 HARDWARE_DEVICE_PATH,
31 HW_VENDOR_DP,
32 {
33 (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
34 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
35 }
36 },
37 USER_PROFILE_MANAGER_GUID
38 },
39 {
40 END_DEVICE_PATH_TYPE,
41 END_ENTIRE_DEVICE_PATH_SUBTYPE,
42 {
43 (UINT8) (END_DEVICE_PATH_LENGTH),
44 (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
45 }
46 }
47 };
48
49
50 /**
51 Get string by string id from HII Interface.
52
53
54 @param[in] Id String ID to get the string from.
55
56 @retval CHAR16 * String from ID.
57 @retval NULL If error occurs.
58
59 **/
60 CHAR16 *
61 GetStringById (
62 IN EFI_STRING_ID Id
63 )
64 {
65 //
66 // Get the current string for the current Language.
67 //
68 return HiiGetString (mCallbackInfo->HiiHandle, Id, NULL);
69 }
70
71
72 /**
73 This function gets all the credential providers in the system and saved them
74 to mProviderInfo.
75
76 @retval EFI_SUCESS Init credential provider database successfully.
77 @retval Others Fail to init credential provider database.
78
79 **/
80 EFI_STATUS
81 InitProviderInfo (
82 VOID
83 )
84 {
85 EFI_STATUS Status;
86 UINTN HandleCount;
87 EFI_HANDLE *HandleBuf;
88 UINTN Index;
89
90 //
91 // Try to find all the user credential provider driver.
92 //
93 HandleCount = 0;
94 HandleBuf = NULL;
95 Status = gBS->LocateHandleBuffer (
96 ByProtocol,
97 &gEfiUserCredential2ProtocolGuid,
98 NULL,
99 &HandleCount,
100 &HandleBuf
101 );
102 if (EFI_ERROR (Status)) {
103 return Status;
104 }
105
106 //
107 // Get provider infomation.
108 //
109 if (mProviderInfo != NULL) {
110 FreePool (mProviderInfo);
111 }
112 mProviderInfo = AllocateZeroPool (
113 sizeof (CREDENTIAL_PROVIDER_INFO) -
114 sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *) +
115 HandleCount * sizeof (EFI_USER_CREDENTIAL2_PROTOCOL *)
116 );
117 if (mProviderInfo == NULL) {
118 FreePool (HandleBuf);
119 return EFI_OUT_OF_RESOURCES;
120 }
121
122 mProviderInfo->Count = HandleCount;
123 for (Index = 0; Index < HandleCount; Index++) {
124 Status = gBS->HandleProtocol (
125 HandleBuf[Index],
126 &gEfiUserCredential2ProtocolGuid,
127 (VOID **) &mProviderInfo->Provider[Index]
128 );
129 if (EFI_ERROR (Status)) {
130 FreePool (HandleBuf);
131 FreePool (mProviderInfo);
132 mProviderInfo = NULL;
133 return Status;
134 }
135 }
136
137 FreePool (HandleBuf);
138 return EFI_SUCCESS;
139 }
140
141
142 /**
143 This function processes changes in user profile configuration.
144
145 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
146 @param Action Specifies the type of action taken by the browser.
147 @param QuestionId A unique value which is sent to the original
148 exporting driver so that it can identify the type
149 of data to expect.
150 @param Type The type of value for the question.
151 @param Value A pointer to the data being sent to the original
152 exporting driver.
153 @param ActionRequest On return, points to the action requested by the
154 callback function.
155
156 @retval EFI_SUCCESS The callback successfully handled the action.
157 @retval Others Fail to handle the action.
158
159 **/
160 EFI_STATUS
161 EFIAPI
162 UserProfileManagerCallback (
163 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
164 IN EFI_BROWSER_ACTION Action,
165 IN EFI_QUESTION_ID QuestionId,
166 IN UINT8 Type,
167 IN EFI_IFR_TYPE_VALUE *Value,
168 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
169 )
170 {
171 EFI_STATUS Status;
172 EFI_INPUT_KEY Key;
173 UINT32 CurrentAccessRight;
174 CHAR16 *QuestionStr;
175 CHAR16 *PromptStr;
176 VOID *StartOpCodeHandle;
177 VOID *EndOpCodeHandle;
178 EFI_IFR_GUID_LABEL *StartLabel;
179 EFI_IFR_GUID_LABEL *EndLabel;
180 EFI_USER_PROFILE_HANDLE CurrentUser;
181
182 Status = EFI_SUCCESS;
183
184 switch (Action) {
185 case EFI_BROWSER_ACTION_FORM_OPEN:
186 {
187 //
188 // Update user manage Form when user manage Form is opened.
189 // This will be done only in FORM_OPEN CallBack of question with QUESTIONID_USER_MANAGE from user manage Form.
190 //
191 if (QuestionId != QUESTIONID_USER_MANAGE) {
192 return EFI_SUCCESS;
193 }
194
195 //
196 // Get current user
197 //
198 CurrentUser = NULL;
199 mUserManager->Current (mUserManager, &CurrentUser);
200 if (CurrentUser == NULL) {
201 DEBUG ((DEBUG_ERROR, "Error: current user does not exist!\n"));
202 return EFI_NOT_READY;
203 }
204
205 //
206 // Get current user's right information.
207 //
208 Status = GetAccessRight (&CurrentAccessRight);
209 if (EFI_ERROR (Status)) {
210 CurrentAccessRight = EFI_USER_INFO_ACCESS_ENROLL_SELF;
211 }
212
213 //
214 // Init credential provider information.
215 //
216 Status = InitProviderInfo ();
217 if (EFI_ERROR (Status)) {
218 return Status;
219 }
220
221 //
222 // Initialize the container for dynamic opcodes.
223 //
224 StartOpCodeHandle = HiiAllocateOpCodeHandle ();
225 ASSERT (StartOpCodeHandle != NULL);
226
227 EndOpCodeHandle = HiiAllocateOpCodeHandle ();
228 ASSERT (EndOpCodeHandle != NULL);
229
230 //
231 // Create Hii Extend Label OpCode.
232 //
233 StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
234 StartOpCodeHandle,
235 &gEfiIfrTianoGuid,
236 NULL,
237 sizeof (EFI_IFR_GUID_LABEL)
238 );
239 StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
240 StartLabel->Number = LABEL_USER_MANAGE_FUNC;
241
242 EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
243 EndOpCodeHandle,
244 &gEfiIfrTianoGuid,
245 NULL,
246 sizeof (EFI_IFR_GUID_LABEL)
247 );
248 EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
249 EndLabel->Number = LABEL_END;
250
251 //
252 // Add user profile option.
253 //
254 if ((CurrentAccessRight == EFI_USER_INFO_ACCESS_MANAGE) ||
255 (CurrentAccessRight == EFI_USER_INFO_ACCESS_ENROLL_OTHERS)
256 ) {
257 HiiCreateActionOpCode (
258 StartOpCodeHandle, // Container for dynamic created opcodes
259 KEY_ADD_USER, // Question ID
260 STRING_TOKEN (STR_ADD_USER_TITLE), // Prompt text
261 STRING_TOKEN (STR_ADD_USER_HELP), // Help text
262 EFI_IFR_FLAG_CALLBACK, // Question flag
263 0 // Action String ID
264 );
265 }
266
267 //
268 // Add modify user profile option.
269 //
270 HiiCreateGotoOpCode (
271 StartOpCodeHandle, // Container for dynamic created opcodes
272 FORMID_MODIFY_USER, // Target Form ID
273 STRING_TOKEN (STR_MODIFY_USER_TITLE), // Prompt text
274 STRING_TOKEN (STR_MODIFY_USER_HELP), // Help text
275 EFI_IFR_FLAG_CALLBACK, // Question flag
276 KEY_MODIFY_USER // Question ID
277 );
278
279 //
280 // Add delete user profile option
281 //
282 if (CurrentAccessRight == EFI_USER_INFO_ACCESS_MANAGE) {
283 HiiCreateGotoOpCode (
284 StartOpCodeHandle, // Container for dynamic created opcodes
285 FORMID_DEL_USER, // Target Form ID
286 STRING_TOKEN (STR_DELETE_USER_TITLE), // Prompt text
287 STRING_TOKEN (STR_DELETE_USER_HELP), // Help text
288 EFI_IFR_FLAG_CALLBACK, // Question flag
289 KEY_DEL_USER // Question ID
290 );
291 }
292
293 HiiUpdateForm (
294 mCallbackInfo->HiiHandle, // HII handle
295 &gUserProfileManagerGuid, // Formset GUID
296 FORMID_USER_MANAGE, // Form ID
297 StartOpCodeHandle, // Label for where to insert opcodes
298 EndOpCodeHandle // Replace data
299 );
300
301 HiiFreeOpCodeHandle (StartOpCodeHandle);
302 HiiFreeOpCodeHandle (EndOpCodeHandle);
303
304 return EFI_SUCCESS;
305 }
306 break;
307
308 case EFI_BROWSER_ACTION_FORM_CLOSE:
309 Status = EFI_SUCCESS;
310 break;
311
312 case EFI_BROWSER_ACTION_CHANGED:
313 {
314 //
315 // Handle the request from form.
316 //
317 if ((Value == NULL) || (ActionRequest == NULL)) {
318 return EFI_INVALID_PARAMETER;
319 }
320
321 //
322 // Judge first 2 bits.
323 //
324 switch (QuestionId & KEY_FIRST_FORM_MASK) {
325 //
326 // Add user profile operation.
327 //
328 case KEY_ADD_USER:
329 CallAddUser ();
330 break;
331
332 //
333 // Delete user profile operation.
334 //
335 case KEY_DEL_USER:
336 //
337 // Judge next 2 bits.
338 //
339 switch (QuestionId & KEY_SECOND_FORM_MASK) {
340 //
341 // Delete specified user profile.
342 //
343 case KEY_SELECT_USER:
344 DeleteUser ((UINT8) QuestionId);
345 //
346 // Update select user form after delete a user.
347 //
348 SelectUserToDelete ();
349 break;
350
351 default:
352 break;
353 }
354 break;
355
356 //
357 // Modify user profile operation.
358 //
359 case KEY_MODIFY_USER:
360 //
361 // Judge next 2 bits.
362 //
363 switch (QuestionId & KEY_SECOND_FORM_MASK) {
364 //
365 // Enter user profile information form.
366 //
367 case KEY_SELECT_USER:
368 //
369 // Judge next 3 bits.
370 //
371 switch (QuestionId & KEY_MODIFY_INFO_MASK) {
372 //
373 // Modify user name.
374 //
375 case KEY_MODIFY_NAME:
376 ModifyUserName ();
377 //
378 // Update username in parent form.
379 //
380 SelectUserToModify ();
381 break;
382
383 //
384 // Modify identity policy.
385 //
386 case KEY_MODIFY_IP:
387 //
388 // Judge next 3 bits
389 //
390 switch (QuestionId & KEY_MODIFY_IP_MASK) {
391 //
392 // Change credential provider option.
393 //
394 case KEY_MODIFY_PROV:
395 mProviderChoice = Value->u8;
396 break;
397
398 //
399 // Change logical connector.
400 //
401 case KEY_MODIFY_CONN:
402 mConncetLogical = Value->u8;
403 break;
404
405 //
406 // Save option.
407 //
408 case KEY_ADD_IP_OP:
409 AddIdentityPolicyItem ();
410 break;
411
412 //
413 // Return to user profile information form.
414 //
415 case KEY_IP_RETURN_UIF:
416 SaveIdentityPolicy ();
417 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
418 break;
419
420 default:
421 break;
422 }
423 break;
424
425 //
426 // Modify access policy.
427 //
428 case KEY_MODIFY_AP:
429 //
430 // Judge next 3 bits.
431 //
432 switch (QuestionId & KEY_MODIFY_AP_MASK) {
433 //
434 // Change access right choice.
435 //
436 case KEY_MODIFY_RIGHT:
437 mAccessInfo.AccessRight = Value->u8;
438 break;
439
440 //
441 // Change setup choice.
442 //
443 case KEY_MODIFY_SETUP:
444 mAccessInfo.AccessSetup= Value->u8;
445 break;
446
447 //
448 // Change boot order choice.
449 //
450 case KEY_MODIFY_BOOT:
451 mAccessInfo.AccessBootOrder = Value->u32;
452 break;
453
454 //
455 // Load device path form.
456 //
457 case KEY_MODIFY_LOAD:
458 //
459 // Judge next 2 bits.
460 //
461 switch (QuestionId & KEY_DISPLAY_DP_MASK) {
462 //
463 // Permit load device path.
464 //
465 case KEY_PERMIT_MODIFY:
466 DisplayLoadPermit ();
467 break;
468
469 //
470 // Forbid load device path.
471 //
472 case KEY_FORBID_MODIFY:
473 DisplayLoadForbid ();
474 break;
475
476 default:
477 break;
478 }
479 break;
480
481 //
482 // Connect device path form.
483 //
484 case KEY_MODIFY_CONNECT:
485 //
486 // Judge next 2 bits.
487 //
488 switch (QuestionId & KEY_DISPLAY_DP_MASK) {
489 //
490 // Permit connect device path.
491 //
492 case KEY_PERMIT_MODIFY:
493 DisplayConnectPermit ();
494 break;
495
496 //
497 // Forbid connect device path.
498 //
499 case KEY_FORBID_MODIFY:
500 DisplayConnectForbid ();
501 break;
502
503 default:
504 break;
505 }
506 break;
507
508 //
509 // Return to user profile information form.
510 //
511 case KEY_AP_RETURN_UIF:
512 SaveAccessPolicy ();
513 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
514 break;
515
516 default:
517 break;
518 }
519 break;
520
521 default:
522 break;
523 }
524 break;
525
526 //
527 // Access policy device path modified.
528 //
529 case KEY_MODIFY_AP_DP:
530 //
531 // Judge next 2 bits.
532 //
533 switch (QuestionId & KEY_MODIFY_DP_MASK) {
534 //
535 // Load permit device path modified.
536 //
537 case KEY_LOAD_PERMIT_MODIFY:
538 QuestionStr = GetStringById (STRING_TOKEN (STR_MOVE_TO_FORBID_LIST));
539 PromptStr = GetStringById (STRING_TOKEN (STR_PRESS_KEY_CONTINUE));
540 CreatePopUp (
541 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
542 &Key,
543 QuestionStr,
544 L"",
545 PromptStr,
546 NULL
547 );
548 FreePool (QuestionStr);
549 FreePool (PromptStr);
550 if (Key.UnicodeChar != CHAR_CARRIAGE_RETURN) {
551 break;
552 }
553
554 AddToForbidLoad ((UINT16)(QuestionId & (KEY_MODIFY_DP_MASK - 1)));
555 DisplayLoadPermit ();
556 break;
557
558 //
559 // Load forbid device path modified.
560 //
561 case KEY_LOAD_FORBID_MODIFY:
562 QuestionStr = GetStringById (STRING_TOKEN (STR_MOVE_TO_PERMIT_LIST));
563 PromptStr = GetStringById (STRING_TOKEN (STR_PRESS_KEY_CONTINUE));
564 CreatePopUp (
565 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
566 &Key,
567 QuestionStr,
568 L"",
569 PromptStr,
570 NULL
571 );
572 FreePool (QuestionStr);
573 FreePool (PromptStr);
574 if (Key.UnicodeChar != CHAR_CARRIAGE_RETURN) {
575 break;
576 }
577
578 DeleteFromForbidLoad ((UINT16)(QuestionId & (KEY_MODIFY_DP_MASK - 1)));
579 DisplayLoadForbid ();
580 break;
581
582 //
583 // Connect permit device path modified.
584 //
585 case KEY_CONNECT_PERMIT_MODIFY:
586 break;
587
588 //
589 // Connect forbid device path modified.
590 //
591 case KEY_CONNECT_FORBID_MODIFY:
592 break;
593
594 default:
595 break;
596 }
597 break;
598
599 default:
600 break;
601 }
602 break;
603
604 default:
605 break;
606 }
607 }
608 break;
609
610
611 case EFI_BROWSER_ACTION_CHANGING:
612 {
613 //
614 // Handle the request from form.
615 //
616 if (Value == NULL) {
617 return EFI_INVALID_PARAMETER;
618 }
619
620 //
621 // Judge first 2 bits.
622 //
623 switch (QuestionId & KEY_FIRST_FORM_MASK) {
624 //
625 // Delete user profile operation.
626 //
627 case KEY_DEL_USER:
628 //
629 // Judge next 2 bits.
630 //
631 switch (QuestionId & KEY_SECOND_FORM_MASK) {
632 //
633 // Enter delete user profile form.
634 //
635 case KEY_ENTER_NEXT_FORM:
636 SelectUserToDelete ();
637 break;
638
639 default:
640 break;
641 }
642 break;
643
644 //
645 // Modify user profile operation.
646 //
647 case KEY_MODIFY_USER:
648 //
649 // Judge next 2 bits.
650 //
651 switch (QuestionId & KEY_SECOND_FORM_MASK) {
652 //
653 // Enter modify user profile form.
654 //
655 case KEY_ENTER_NEXT_FORM:
656 SelectUserToModify ();
657 break;
658
659 //
660 // Enter user profile information form.
661 //
662 case KEY_SELECT_USER:
663 //
664 // Judge next 3 bits.
665 //
666 switch (QuestionId & KEY_MODIFY_INFO_MASK) {
667 //
668 // Display user information form.
669 //
670 case KEY_ENTER_NEXT_FORM:
671 ModifyUserInfo ((UINT8) QuestionId);
672 break;
673
674 //
675 // Modify identity policy.
676 //
677 case KEY_MODIFY_IP:
678 //
679 // Judge next 3 bits
680 //
681 switch (QuestionId & KEY_MODIFY_IP_MASK) {
682 //
683 // Display identity policy modify form.
684 //
685 case KEY_ENTER_NEXT_FORM:
686 ModifyIdentityPolicy ();
687 break;
688
689 default:
690 break;
691 }
692 break;
693
694 //
695 // Modify access policy.
696 //
697 case KEY_MODIFY_AP:
698 //
699 // Judge next 3 bits.
700 //
701 switch (QuestionId & KEY_MODIFY_AP_MASK) {
702 //
703 // Display access policy modify form.
704 //
705 case KEY_ENTER_NEXT_FORM:
706 ModidyAccessPolicy ();
707 break;
708
709 default:
710 break;
711 }
712 break;
713
714 default:
715 break;
716 }
717 break;
718
719 default:
720 break;
721 }
722 break;
723
724 default:
725 break;
726 }
727 }
728 break;
729
730 default:
731 //
732 // All other action return unsupported.
733 //
734 Status = EFI_UNSUPPORTED;
735 break;
736 }
737
738
739 return Status;
740 }
741
742
743 /**
744 This function allows a caller to extract the current configuration for one
745 or more named elements from the target driver.
746
747
748 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
749 @param Request A null-terminated Unicode string in <ConfigRequest> format.
750 @param Progress On return, points to a character in the Request string.
751 Points to the string's null terminator if request was successful.
752 Points to the most recent '&' before the first failing name/value
753 pair (or the beginning of the string if the failure is in the
754 first name/value pair) if the request was not successful.
755 @param Results A null-terminated Unicode string in <ConfigAltResp> format which
756 has all values filled in for the names in the Request string.
757 String to be allocated by the called function.
758
759 @retval EFI_SUCCESS The Results is filled with the requested values.
760 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
761 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
762 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
763
764 **/
765 EFI_STATUS
766 EFIAPI
767 FakeExtractConfig (
768 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
769 IN CONST EFI_STRING Request,
770 OUT EFI_STRING *Progress,
771 OUT EFI_STRING *Results
772 )
773 {
774 if (Progress == NULL || Results == NULL) {
775 return EFI_INVALID_PARAMETER;
776 }
777 *Progress = Request;
778 return EFI_NOT_FOUND;
779 }
780
781 /**
782 This function processes the results of changes in configuration.
783
784
785 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
786 @param Configuration A null-terminated Unicode string in <ConfigResp> format.
787 @param Progress A pointer to a string filled in with the offset of the most
788 recent '&' before the first failing name/value pair (or the
789 beginning of the string if the failure is in the first
790 name/value pair) or the terminating NULL if all was successful.
791
792 @retval EFI_SUCCESS The Results is processed successfully.
793 @retval EFI_INVALID_PARAMETER Configuration is NULL.
794 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
795
796 **/
797 EFI_STATUS
798 EFIAPI
799 FakeRouteConfig (
800 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
801 IN CONST EFI_STRING Configuration,
802 OUT EFI_STRING *Progress
803 )
804 {
805 if (Configuration == NULL || Progress == NULL) {
806 return EFI_INVALID_PARAMETER;
807 }
808
809 return EFI_NOT_FOUND;
810 }
811
812
813 /**
814 Main entry for this driver.
815
816 @param ImageHandle Image handle this driver.
817 @param SystemTable Pointer to SystemTable.
818
819 @retval EFI_SUCESS This function always complete successfully.
820
821 **/
822 EFI_STATUS
823 EFIAPI
824 UserProfileManagerInit (
825 IN EFI_HANDLE ImageHandle,
826 IN EFI_SYSTEM_TABLE *SystemTable
827 )
828 {
829 EFI_STATUS Status;
830 USER_PROFILE_MANAGER_CALLBACK_INFO *CallbackInfo;
831
832 Status = gBS->LocateProtocol (
833 &gEfiUserManagerProtocolGuid,
834 NULL,
835 (VOID **) &mUserManager
836 );
837 if (EFI_ERROR (Status)) {
838 return EFI_SUCCESS;
839 }
840
841 //
842 // Initialize driver private data.
843 //
844 ZeroMem (&mUserInfo, sizeof (mUserInfo));
845 ZeroMem (&mAccessInfo, sizeof (mAccessInfo));
846
847 CallbackInfo = AllocateZeroPool (sizeof (USER_PROFILE_MANAGER_CALLBACK_INFO));
848 ASSERT (CallbackInfo != NULL);
849
850 CallbackInfo->Signature = USER_PROFILE_MANAGER_SIGNATURE;
851 CallbackInfo->ConfigAccess.ExtractConfig = FakeExtractConfig;
852 CallbackInfo->ConfigAccess.RouteConfig = FakeRouteConfig;
853 CallbackInfo->ConfigAccess.Callback = UserProfileManagerCallback;
854 CallbackInfo->DriverHandle = NULL;
855
856 //
857 // Install Device Path Protocol and Config Access protocol to driver handle.
858 //
859 Status = gBS->InstallMultipleProtocolInterfaces (
860 &CallbackInfo->DriverHandle,
861 &gEfiDevicePathProtocolGuid,
862 &mHiiVendorDevicePath,
863 &gEfiHiiConfigAccessProtocolGuid,
864 &CallbackInfo->ConfigAccess,
865 NULL
866 );
867 ASSERT_EFI_ERROR (Status);
868
869 //
870 // Publish HII data.
871 //
872 CallbackInfo->HiiHandle = HiiAddPackages (
873 &gUserProfileManagerGuid,
874 CallbackInfo->DriverHandle,
875 UserProfileManagerStrings,
876 UserProfileManagerVfrBin,
877 NULL
878 );
879 ASSERT (CallbackInfo->HiiHandle != NULL);
880 mCallbackInfo = CallbackInfo;
881
882 return Status;
883 }
884
885