mirror of
https://github.com/grub4dos/ntloader.git
synced 2025-05-09 20:21:08 +08:00
handle ucs-2 cmdline
This commit is contained in:
parent
53aeaae50b
commit
505c38a7eb
@ -19,6 +19,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "ntloader.h"
|
#include "ntloader.h"
|
||||||
#include "cmdline.h"
|
#include "cmdline.h"
|
||||||
|
#include "charset.h"
|
||||||
#include "efi.h"
|
#include "efi.h"
|
||||||
#include "efifile.h"
|
#include "efifile.h"
|
||||||
#include "efiblock.h"
|
#include "efiblock.h"
|
||||||
@ -55,14 +56,16 @@ const char sbat[ sizeof (SBAT_CSV) - 1 ] __sbat = SBAT_CSV;
|
|||||||
static void efi_cmdline (EFI_LOADED_IMAGE_PROTOCOL *loaded)
|
static void efi_cmdline (EFI_LOADED_IMAGE_PROTOCOL *loaded)
|
||||||
{
|
{
|
||||||
size_t cmdline_len = (loaded->LoadOptionsSize / sizeof (wchar_t));
|
size_t cmdline_len = (loaded->LoadOptionsSize / sizeof (wchar_t));
|
||||||
char cmdline[ cmdline_len + 1 /* NUL */ ];
|
char *cmdline = efi_malloc (4 * cmdline_len + 1);
|
||||||
const wchar_t *wcmdline = loaded->LoadOptions;
|
|
||||||
|
|
||||||
/* Convert command line to ASCII */
|
/* Convert command line to ASCII */
|
||||||
snprintf (cmdline, sizeof (cmdline), "%ls", wcmdline);
|
*ucs2_to_utf8 ((uint8_t *) cmdline,
|
||||||
|
loaded->LoadOptions, cmdline_len) = 0;
|
||||||
|
|
||||||
/* Process command line */
|
/* Process command line */
|
||||||
process_cmdline (cmdline);
|
process_cmdline (cmdline);
|
||||||
|
|
||||||
|
efi_free (cmdline);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user