Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
7babe823
Commit
7babe823
authored
Aug 12, 2021
by
longpanda
Browse files
Add F5-->Tools-->Ventoy UEFI Utilities-->Show EFI Drivers feature.
parent
6db513a0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
234 additions
and
1 deletion
+234
-1
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c
...le201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c
+0
-1
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/VtoyUtil/VtoyDrv.c
...-stable201911/MdeModulePkg/Application/VtoyUtil/VtoyDrv.c
+140
-0
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/VtoyUtil/VtoyUtil.c
...stable201911/MdeModulePkg/Application/VtoyUtil/VtoyUtil.c
+31
-0
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/VtoyUtil/VtoyUtil.h
...stable201911/MdeModulePkg/Application/VtoyUtil/VtoyUtil.h
+2
-0
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/VtoyUtil/VtoyUtil.inf
...able201911/MdeModulePkg/Application/VtoyUtil/VtoyUtil.inf
+1
-0
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
+51
-0
INSTALL/grub/debug.cfg
INSTALL/grub/debug.cfg
+9
-0
No files found.
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c
View file @
7babe823
...
...
@@ -910,7 +910,6 @@ STATIC EFI_STATUS ventoy_find_filesystem_driverbind(VOID)
Status
=
gBS
->
HandleProtocol
(
Handles
[
i
],
&
gEfiComponentNameProtocolGuid
,
(
VOID
**
)
&
NameProtocol
);
if
(
EFI_ERROR
(
Status
))
{
debug
();
continue
;
}
...
...
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/VtoyUtil/VtoyDrv.c
0 → 100644
View file @
7babe823
/******************************************************************************
* VtoyDrv.c
*
* Copyright (c) 2020, longpanda <admin@ventoy.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
#include <Uefi.h>
#include <Library/DebugLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiApplicationEntryPoint.h>
#include <Protocol/LoadedImage.h>
#include <Guid/FileInfo.h>
#include <Guid/FileSystemInfo.h>
#include <Protocol/BlockIo.h>
#include <Protocol/RamDisk.h>
#include <Protocol/SimpleFileSystem.h>
#include <VtoyUtil.h>
STATIC
UINTN
g_EfiDriverNameCnt
=
0
;
STATIC
CHAR16
*
g_EfiDriverNameList
[
1024
]
=
{
NULL
};
STATIC
EFI_STATUS
AddEfiDriverName
(
IN
CHAR16
*
DriverName
)
{
UINTN
i
=
0
;
if
(
g_EfiDriverNameCnt
>=
1024
)
{
return
EFI_OUT_OF_RESOURCES
;
}
for
(
i
=
0
;
i
<
g_EfiDriverNameCnt
;
i
++
)
{
if
(
g_EfiDriverNameList
[
i
]
&&
StrCmp
(
g_EfiDriverNameList
[
i
],
DriverName
)
==
0
)
{
break
;
}
}
if
(
i
>=
g_EfiDriverNameCnt
)
{
g_EfiDriverNameList
[
g_EfiDriverNameCnt
]
=
DriverName
;
g_EfiDriverNameCnt
++
;
}
return
EFI_SUCCESS
;
}
EFI_STATUS
ShowEfiDrivers
(
IN
EFI_HANDLE
ImageHandle
,
IN
CONST
CHAR16
*
CmdLine
)
{
UINTN
i
=
0
;
UINTN
Count
=
0
;
CHAR16
*
DriverName
=
NULL
;
EFI_HANDLE
*
Handles
=
NULL
;
EFI_STATUS
Status
=
EFI_SUCCESS
;
EFI_COMPONENT_NAME_PROTOCOL
*
NameProtocol
=
NULL
;
EFI_COMPONENT_NAME2_PROTOCOL
*
Name2Protocol
=
NULL
;
(
VOID
)
ImageHandle
;
(
VOID
)
CmdLine
;
Status
=
gBS
->
LocateHandleBuffer
(
ByProtocol
,
&
gEfiComponentName2ProtocolGuid
,
NULL
,
&
Count
,
&
Handles
);
if
(
EFI_ERROR
(
Status
))
{
return
Status
;
}
for
(
i
=
0
;
i
<
Count
;
i
++
)
{
Status
=
gBS
->
HandleProtocol
(
Handles
[
i
],
&
gEfiComponentName2ProtocolGuid
,
(
VOID
**
)
&
Name2Protocol
);
if
(
EFI_ERROR
(
Status
))
{
continue
;
}
DriverName
=
NULL
;
Status
=
VtoyGetComponentName
(
2
,
Name2Protocol
,
&
DriverName
);
if
((
!
EFI_ERROR
(
Status
))
&&
(
DriverName
))
{
AddEfiDriverName
(
DriverName
);
}
}
Count
=
0
;
FreePool
(
Handles
);
Handles
=
NULL
;
Status
=
gBS
->
LocateHandleBuffer
(
ByProtocol
,
&
gEfiComponentNameProtocolGuid
,
NULL
,
&
Count
,
&
Handles
);
if
(
EFI_ERROR
(
Status
))
{
return
Status
;
}
for
(
i
=
0
;
i
<
Count
;
i
++
)
{
Status
=
gBS
->
HandleProtocol
(
Handles
[
i
],
&
gEfiComponentNameProtocolGuid
,
(
VOID
**
)
&
NameProtocol
);
if
(
EFI_ERROR
(
Status
))
{
continue
;
}
DriverName
=
NULL
;
Status
=
VtoyGetComponentName
(
1
,
Name2Protocol
,
&
DriverName
);
if
((
!
EFI_ERROR
(
Status
))
&&
(
DriverName
))
{
AddEfiDriverName
(
DriverName
);
}
}
FreePool
(
Handles
);
for
(
i
=
0
;
i
<
g_EfiDriverNameCnt
;
i
++
)
{
Printf
(
"%2d %s
\n
"
,
i
,
g_EfiDriverNameList
[
i
]);
}
return
EFI_SUCCESS
;
}
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/VtoyUtil/VtoyUtil.c
View file @
7babe823
...
...
@@ -44,8 +44,39 @@ STATIC grub_env_printf_pf g_env_printf = NULL;
STATIC
VtoyUtilFeature
gFeatureList
[]
=
{
{
L"fix_windows_mmap"
,
FixWindowsMemhole
},
{
L"show_efi_drivers"
,
ShowEfiDrivers
},
};
EFI_STATUS
VtoyGetComponentName
(
IN
UINTN
Ver
,
IN
VOID
*
Protocol
,
OUT
CHAR16
**
DriverName
)
{
EFI_STATUS
Status
=
EFI_SUCCESS
;
CHAR16
*
DrvName
=
NULL
;
EFI_COMPONENT_NAME_PROTOCOL
*
NameProtocol
=
NULL
;
EFI_COMPONENT_NAME2_PROTOCOL
*
Name2Protocol
=
NULL
;
if
(
1
==
Ver
)
{
NameProtocol
=
(
EFI_COMPONENT_NAME_PROTOCOL
*
)
Protocol
;
Status
=
NameProtocol
->
GetDriverName
(
Protocol
,
"en"
,
&
DrvName
);
if
(
EFI_ERROR
(
Status
)
||
NULL
==
DrvName
)
{
Status
=
NameProtocol
->
GetDriverName
(
Protocol
,
"eng"
,
&
DrvName
);
}
}
else
{
Name2Protocol
=
(
EFI_COMPONENT_NAME2_PROTOCOL
*
)
Protocol
;
Status
=
Name2Protocol
->
GetDriverName
(
Protocol
,
"en"
,
&
DrvName
);
if
(
EFI_ERROR
(
Status
)
||
NULL
==
DrvName
)
{
Status
=
Name2Protocol
->
GetDriverName
(
Protocol
,
"eng"
,
&
DrvName
);
}
}
*
DriverName
=
DrvName
;
return
Status
;
}
VOID
EFIAPI
VtoyUtilDebug
(
IN
CONST
CHAR8
*
Format
,
...)
{
VA_LIST
Marker
;
...
...
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/VtoyUtil/VtoyUtil.h
View file @
7babe823
...
...
@@ -57,7 +57,9 @@ VOID EFIAPI VtoyUtilDebug(IN CONST CHAR8 *Format, ...);
#define debug(expr, ...) if (gVtoyDebugPrint) VtoyUtilDebug("[VTOY] "expr"\n", ##__VA_ARGS__)
#define Printf VtoyUtilDebug
EFI_STATUS
VtoyGetComponentName
(
IN
UINTN
Ver
,
IN
VOID
*
Protocol
,
OUT
CHAR16
**
DriverName
);
EFI_STATUS
FixWindowsMemhole
(
IN
EFI_HANDLE
ImageHandle
,
IN
CONST
CHAR16
*
CmdLine
);
EFI_STATUS
ShowEfiDrivers
(
IN
EFI_HANDLE
ImageHandle
,
IN
CONST
CHAR16
*
CmdLine
);
#endif
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/VtoyUtil/VtoyUtil.inf
View file @
7babe823
...
...
@@ -28,6 +28,7 @@
[Sources]
VtoyUtil.h
VtoyUtil.c
VtoyDrv.c
Memhole.c
[Packages]
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
View file @
7babe823
...
...
@@ -127,6 +127,9 @@ static grub_uint64_t g_enumerate_start_time_ms;
static
grub_uint64_t
g_enumerate_finish_time_ms
;
static
int
g_vtoy_file_flt
[
VTOY_FILE_FLT_BUTT
]
=
{
0
};
static
int
g_pager_flag
=
0
;
static
char
g_old_pager
[
32
];
static
const
char
*
g_vtoy_winpeshl_ini
=
"[LaunchApps]
\r\n
vtoyjump.exe"
;
static
const
char
*
g_menu_class
[]
=
...
...
@@ -4646,6 +4649,52 @@ fail:
VENTOY_CMD_RETURN
(
GRUB_ERR_NONE
);
}
static
grub_err_t
ventoy_cmd_push_pager
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
{
const
char
*
pager
=
NULL
;
(
void
)
ctxt
;
(
void
)
argc
;
(
void
)
args
;
pager
=
grub_env_get
(
"pager"
);
if
(
NULL
==
pager
)
{
g_pager_flag
=
1
;
grub_env_set
(
"pager"
,
"1"
);
}
else
if
(
pager
[
0
]
==
'1'
)
{
g_pager_flag
=
0
;
}
else
{
grub_snprintf
(
g_old_pager
,
sizeof
(
g_old_pager
),
"%s"
,
pager
);
g_pager_flag
=
2
;
grub_env_set
(
"pager"
,
"1"
);
}
VENTOY_CMD_RETURN
(
GRUB_ERR_NONE
);
}
static
grub_err_t
ventoy_cmd_pop_pager
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
{
(
void
)
ctxt
;
(
void
)
argc
;
(
void
)
args
;
if
(
g_pager_flag
==
1
)
{
grub_env_unset
(
"pager"
);
}
else
if
(
g_pager_flag
==
2
)
{
grub_env_set
(
"pager"
,
g_old_pager
);
}
VENTOY_CMD_RETURN
(
GRUB_ERR_NONE
);
}
int
ventoy_env_init
(
void
)
{
char
buf
[
64
];
...
...
@@ -4821,6 +4870,8 @@ static cmd_para ventoy_cmds[] =
{
"vt_get_efi_vdisk_offset"
,
ventoy_cmd_get_efivdisk_offset
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_search_replace_initrd"
,
ventoy_cmd_search_replace_initrd
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_push_pager"
,
ventoy_cmd_push_pager
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_pop_pager"
,
ventoy_cmd_pop_pager
,
0
,
NULL
,
""
,
""
,
NULL
},
};
int
ventoy_register_all_cmd
(
void
)
...
...
INSTALL/grub/debug.cfg
View file @
7babe823
...
...
@@ -40,6 +40,15 @@ submenu "Screen Display Mode" --class=debug_screen_mode --class=F5tool {
if [ "$grub_platform" != "pc" ]; then
submenu 'Ventoy UEFI Utilities' --class=debug_util --class=F5tool {
menuentry 'Show EFI Drivers' --class=debug_util_efidrv --class=debug_util --class=F5tool {
vt_push_pager
chainloader ${vtoy_path}/vtoyutil_${VTOY_EFI_ARCH}.efi env_param=${env_param} ${vtdebug_flag} feature=show_efi_drivers
boot
vt_pop_pager
echo -e "\npress ENTER to exit ..."
read vtInputKey
}
menuentry 'Fixup Windows BlinitializeLibrary Failure' --class=debug_util_blinit --class=debug_util --class=F5tool {
chainloader ${vtoy_path}/vtoyutil_${VTOY_EFI_ARCH}.efi env_param=${env_param} ${vtdebug_flag} feature=fix_windows_mmap
boot
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment