无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站广告联系 微信:wuyouceo QQ:184822951
楼主: liuzhaoyzz
打印 上一主题 下一主题

请问下有没有办法用批处理或者命令行小程序确定系统引导分区?

    [复制链接]
1#
发表于 2021-1-6 19:18:38 | 显示全部楼层
本帖最后由 plusv 于 2021-1-6 19:20 编辑
CodeHz 发表于 2021-1-6 18:54
通过逆向 bcdedit 我找到了如下几个可能相关的,但是没文档的 api :
NtEnumerateBootEntries
NtQueryBoo ...


NtEnumerateBootEntries(
  OUT PVOID Buffer,
  IN OUT PULONG BufferLength
  );

Routine Description:

    This function returns a list of all existing boot entries.

    N.B. This service requires the system environment privilege.

Arguments:

    Buffer - Supplies the address of the buffer that is to receive the
        returned data. The returned data is a sequence of BOOT_ENTRY_LIST
        structures.

    BufferLength - On input, supplies the length in bytes of the buffer.
        On output, returns the length in bytes of the returned data.
        If the input buffer is large enough, then BufferLength indicates
        the amount of data copied into Buffer. If the input buffer
        is too small, then BufferLength indicates the required buffer length.

Return Value:

    STATUS_SUCCESS              The function succeeded.
    STATUS_BUFFER_TOO_SMALL     The input buffer was too small.
    STATUS_INVALID_PARAMETER    One of the parameters is invalid.
    STATUS_NOT_IMPLEMENTED      This function is not supported on this platform.
    STATUS_UNSUCCESSFUL         The firmware returned an unrecognized error.
    STATUS_PRIVILEGE_NOT_HELD   The caller does not have the required privilege.
    STATUS_ACCESS_VIOLATION     One of the input parameters cannot be read,
                                or one of the output parameters cannot be written.

==================================================================================
NtQueryBootOptions(
  OUT PBOOT_OPTIONS BootOptions,
  IN OUT PULONG BootOptionsLength
  );

Routine Description:

    This function returns the system's global boot options.

    N.B. This service requires the system environment privilege.

Arguments:

    BootOptions - Supplies the address of the buffer that is to receive the
        returned data.

    BootOptionsLength - On input, supplies the length in bytes of the buffer.
        On output, returns the length in bytes of the returned data.
        If the input buffer is large enough, then BootOptionsLength indicates
        the amount of data copied into BootOptions. If the input buffer
        is too small, then BootOptionsLength indicates the required buffer
        length.

Return Value:

    STATUS_SUCCESS              The function succeeded.
    STATUS_BUFFER_TOO_SMALL     The input buffer was too small.
    STATUS_INVALID_PARAMETER    One of the parameters is invalid.
    STATUS_NOT_IMPLEMENTED      This function is not supported on this platform.
    STATUS_UNSUCCESSFUL         The firmware returned an unrecognized error.
    STATUS_PRIVILEGE_NOT_HELD   The caller does not have the required privilege.
    STATUS_ACCESS_VIOLATION     One of the input parameters cannot be read,
                                or one of the output parameters cannot be written.
==================================================================================
NtQueryBootEntryOrder(
  OUT PULONG Ids,
  IN OUT PULONG Count
  );

Routine Description:

    This function returns the system boot order list.

    N.B. This service requires the system environment privilege.

Arguments:

    Ids - Supplies the address of the buffer that is to receive the
        returned data. The returned data is an array of ULONG boot
        entry identifiers.

    Count - On input, supplies the length in ULONGs of the buffer.
        On output, returns the length in ULONGs of the returned data.
        If the input buffer is large enough, then Count indicates
        the amount of data copied into Buffer. If the input buffer
        is too small, then Count indicates the required buffer length.

Return Value:

    STATUS_SUCCESS              The function succeeded.
    STATUS_BUFFER_TOO_SMALL     The input buffer was too small.
    STATUS_INVALID_PARAMETER    One of the parameters is invalid.
    STATUS_NOT_IMPLEMENTED      This function is not supported on this platform.
    STATUS_UNSUCCESSFUL         The firmware returned an unrecognized error.
    STATUS_PRIVILEGE_NOT_HELD   The caller does not have the required privilege.
    STATUS_ACCESS_VIOLATION     One of the input parameters cannot be read,
                                or one of the output parameters cannot be written.

回复

使用道具 举报

2#
发表于 2021-1-6 19:35:07 | 显示全部楼层
查了 Google
可能有用的 API

NtAddBootEntry
NtDeleteBootEntry
NtModifyBootEntry
NtEnumerateBootEntries

NtQueryBootEntryOrder
NtQueryBootOptions

NtSetBootEntryOrder
NtSetBootOptions
回复

使用道具 举报

3#
发表于 2021-1-7 13:44:45 | 显示全部楼层
CodeHz 发表于 2021-1-7 13:33
继续研究了一下,似乎就是\Device\SystemPartition这个路径对应引导分区,至少在我这里是这样的。。。(关 ...

Windows 7 X64 完整版,
没有这些符号链接.

点评

在GLOBAL??下找找看有没有对应的(  详情 回复 发表于 2021-1-7 13:46
回复

使用道具 举报

4#
发表于 2021-1-7 13:47:37 | 显示全部楼层
WuYou 从昨晚到现在都很卡,
网速只有 0.000-0.030 Mbps,
传个 78 KB 小图都很久,
快晕了.

点评

我这每次发东西都得刷新才能发出来(也不知道哪里的问题)  详情 回复 发表于 2021-1-7 13:48
回复

使用道具 举报

5#
发表于 2021-1-7 13:50:50 | 显示全部楼层
CodeHz 发表于 2021-1-7 13:46
在GLOBAL??下找找看有没有对应的(直接按符号链接排序,找找有没有对应引导分区且有显著标志的

也是没有.

WuYou 从昨晚到现在都很卡,
网速只有 0.000-0.030 Mbps,
不传图了
回复

使用道具 举报

6#
发表于 2021-1-7 14:00:33 | 显示全部楼层
CodeHz 发表于 2021-1-7 13:51
我这边GLOBAL??里磁盘相关的有这些项目

也是没有.


回复

使用道具 举报

7#
发表于 2021-1-15 15:36:29 | 显示全部楼层
CodeHz 发表于 2021-1-15 15:17
我认为根本不用检测,直接尝试两个路径(sysnative, system32)就好了

反应一个小问题

SmartMountFirmware X64 多了一个 pdata 区段,
删了运行也正常,还省了 512 Bytes.



SmartMountFirmware_Remove_pdata.rar

3.33 KB, 下载次数: 11, 下载积分: 无忧币 -2

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-5-3 15:42

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表