Skip to content

Commit 787b083

Browse files
committed
cmd übergabe funktioniert!
1 parent 5df4fbf commit 787b083

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

disable-ram-area.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) {
1717
EFI_BOOT_SERVICES *boot_services = system_table->BootServices;
1818
EFI_SIMPLE_TEXT_OUT_PROTOCOL *console_output = system_table->ConOut;
1919

20-
// Call HandleProtocol directly for EFI 1.1
20+
// Call HandleProtocol directly for EFI 1.1 to retrieve the loaded image protocol
2121
status = boot_services->HandleProtocol(image_handle, &LoadedImageProtocol, (void **)&loaded_image);
2222
if (EFI_ERROR(status)) {
2323
// Create a simple error message
@@ -28,12 +28,26 @@ EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) {
2828
return status;
2929
}
3030

31+
// Check if there are command-line parameters
32+
if (loaded_image->LoadOptionsSize > 0 && loaded_image->LoadOptions != NULL) {
33+
CHAR16 *cmdline = (CHAR16 *)loaded_image->LoadOptions;
34+
35+
// Output the command line arguments
36+
CHAR16 cmdline_message[] = L"Received command line arguments:\r\n";
37+
console_output->OutputString(console_output, cmdline_message);
38+
console_output->OutputString(console_output, cmdline); // Print the command-line options
39+
console_output->OutputString(console_output, L"\r\n");
40+
} else {
41+
CHAR16 no_params_message[] = L"No command line arguments received.\r\n";
42+
console_output->OutputString(console_output, no_params_message);
43+
}
44+
3145
// Success message (optional)
3246
CHAR16 success_message[] = L"Loaded image protocol retrieved successfully.\r\n";
3347
console_output->OutputString(console_output, success_message);
3448

3549
boot_services->Stall(DEFAULT_STALL_TIME_MS * 1000);
36-
50+
3751
return EFI_SUCCESS;
3852
}
3953

0 commit comments

Comments
 (0)