MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / InstallTestFSinjection

Function InstallTestFSinjection

FSInject/Test.c:78–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78EFI_STATUS
79EFIAPI
80InstallTestFSinjection(CHAR16 *TargetDir, CHAR16 *InjectionDir, IN FSI_STRING_LIST *Blacklist, IN FSI_STRING_LIST *ForceLoadKexts)
81{
82 EFI_STATUS Status;
83 FSINJECTION_PROTOCOL *FSInjection;
84 EFI_HANDLE TargetHandle;
85 EFI_HANDLE InjectionHandle;
86
87 Print(L"InstallTestFSinjection ...\n");
88
89 // first get FSINJECTION_PROTOCOL
90 Status = gBS->LocateProtocol(&gFSInjectProtocolGuid, NULL, (void **)&FSInjection);
91 if (EFI_ERROR(Status)) {
92 Print(L"- No FSINJECTION_PROTOCOL, Status = %r\n", Status);
93 return Status;
94 }
95
96 // find our target volume
97 Status = GetVolumeHandleWithDir(TargetDir, &TargetHandle);
98 Print(L"GetVolumeHandleWithDir(%s): %p, Status = %r\n", TargetDir, TargetHandle, Status);
99 if (EFI_ERROR(Status)) {
100 Print(L"- No target volume, Status = %r\n", Status);
101 return Status;
102 }
103 // find volume with dir to inject
104 Status = GetVolumeHandleWithDir(InjectionDir, &InjectionHandle);
105 Print(L"GetVolumeHandleWithDir(%s): %p, Status = %r\n", InjectionDir, InjectionHandle, Status);
106 if (EFI_ERROR(Status)) {
107 Print(L"- No injection volume, Status = %r\n", Status);
108 return Status;
109 }
110
111 // install FSInjection
112 Print(L"- FSInjection->Install(%X, %s, %X, %s) ...\n", TargetHandle, TargetDir, InjectionHandle, InjectionDir);
113 Status = FSInjection->Install(TargetHandle, TargetDir, InjectionHandle, InjectionDir, Blacklist, ForceLoadKexts);
114 if (EFI_ERROR(Status)) {
115 Print(L"- error FSInjection->Install(), Status = %r\n", Status);
116 }
117 return Status;
118
119 /*
120 // let's try to uninstall FS protocol from target
121 Status = gBS->OpenProtocol(TargetHandle, &gEfiSimpleFileSystemProtocolGuid, &FS, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
122 if (EFI_ERROR(Status)) {
123 Print(L"OpenProtocol(gEfiSimpleFileSystemProtocolGuid): %r\n", Status);
124 return Status;
125 }
126 Status = gBS->UninstallMultipleProtocolInterfaces(TargetHandle, &gEfiSimpleFileSystemProtocolGuid, FS, NULL);
127 if (EFI_ERROR(Status)) {
128 Print(L"- error UninstallMultipleProtocolInterfaces for gEfiSimpleFileSystemProtocolGuid, Status = %r\n", Status);
129 return Status;
130 }
131
132 return EFI_SUCCESS;
133 */
134}

Callers 1

FSInjectEntrypointFunction · 0.85

Calls 2

PrintFunction · 0.85
GetVolumeHandleWithDirFunction · 0.85

Tested by

no test coverage detected