Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt6.5和libcef109在适配XP时一些缺失的API #85

Merged
merged 1 commit into from
May 28, 2024

Conversation

cxxzhang
Copy link
Contributor

鸭哥,这是我这边补的一些缺失的API,全部在这里了。
你看着合不合都可以的。

@mingkuang-Chuyu mingkuang-Chuyu changed the base branch from master to Fea/cxxzhang/QT_support May 28, 2024 05:13
@mingkuang-Chuyu mingkuang-Chuyu merged commit f7a2074 into Chuyu-Team:Fea/cxxzhang/QT_support May 28, 2024
@mingkuang-Chuyu
Copy link
Collaborator

mingkuang-Chuyu commented May 28, 2024

感谢大头虾的支持,我先合并到Fea/cxxzhang/QT_support分支,然后再根据实际情况,挑链。

我接受了大多数更改,但是下面几个函数暂时没有接受:

  • CredUIPromptForWindowsCredentialsW
  • NCryptSignHash
  • NCryptGetProperty
  • NCryptFreeObject
  • NCryptCreatePersistedKey
  • NCryptExportKey
  • NCryptFinalizeKey
  • NCryptImportKey
  • NCryptIsAlgSupported
  • NCryptOpenStorageProvider
  • InitPropVariantFromCLSID
  • PSGetPropertyKeyFromName
  • VariantCompare
  • PSCreateMemoryPropertyStore

@lygstate
Copy link
Contributor

lygstate commented May 31, 2024

使用 esent.def 修正JetAddColumnA@28 等函数并不像是一个合理的选择

因为我们无法假定JetAddColumnA@28 JetAddColumn@28 在Vista以及以上一定是同样的实现,这属于操作系统内部细节,最好是直接为其添加 Thunks, 考虑到最新头文件根本没暴露JetAddColumn@28,将JetAddColumn@28也进行Thunks

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    // 由于JetAttachDatabase2A依赖于此函数编译, 故使用 < NTDDI_WIN6, 而不是 < NTDDI_WIN2K
    // Minimum supported server    Windows Server 2000
    __DEFINE_THUNK(
    esent,
    16,
    JET_ERR,
    JET_API,
    JetAttachDatabase2,
        _In_ JET_SESID              sesid,
        _In_ JET_PCSTR              szFilename,
        _In_ const unsigned long    cpgDatabaseSizeMax,
        _In_ JET_GRBIT              grbit
        )
    {
        if (auto const _pfnJetAttachDatabase2 = try_get_JetAttachDatabase2())
        {
            return _pfnJetAttachDatabase2(sesid, szFilename, cpgDatabaseSizeMax, grbit);
        }
        return JET_wrnNyi;
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    // Minimum supported client    Windows Vista
    // Minimum supported server    Windows Server 2008
    __DEFINE_THUNK(
    esent,
    16,
    JET_ERR,
    JET_API,
    JetAttachDatabase2A,
        _In_ JET_SESID              sesid,
        _In_ JET_PCSTR              szFilename,
        _In_ const unsigned long    cpgDatabaseSizeMax,
        _In_ JET_GRBIT              grbit
        )
    {
        if (auto const _pfnJetAttachDatabase2A = try_get_JetAttachDatabase2A())
        {
            return _pfnJetAttachDatabase2A(sesid, szFilename, cpgDatabaseSizeMax, grbit);
        }
        return YY::Thunks::JetAttachDatabase2(sesid, szFilename, cpgDatabaseSizeMax, grbit);
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    // 由于JetBeginSessionA依赖于此函数编译, 故使用 < NTDDI_WIN6, 而不是 < NTDDI_WIN2K
    // Minimum supported server    Windows Server 2000
    __DEFINE_THUNK(
    esent,
    16,
    JET_ERR,
    JET_API,
    JetBeginSession,
        _In_ JET_INSTANCE   instance,
        _Out_ JET_SESID* psesid,
        _In_opt_ JET_PCSTR szUserName,
        _In_opt_ JET_PCSTR szPassword
        )
    {
        if (auto const _pfnJetBeginSession = try_get_JetBeginSession())
        {
            return _pfnJetBeginSession(instance, psesid, szUserName, szPassword);
        }

        return JET_wrnNyi;
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    // Minimum supported client    Windows Vista
    // Minimum supported server    Windows Server 2008
    __DEFINE_THUNK(
    esent,
    16,
    JET_ERR,
    JET_API,
    JetBeginSessionA,
        _In_ JET_INSTANCE   instance,
        _Out_ JET_SESID* psesid,
        _In_opt_ JET_PCSTR szUserName,
        _In_opt_ JET_PCSTR szPassword
        )
    {
        if (auto const _pfnJetBeginSessionA = try_get_JetBeginSessionA())
        {
            return _pfnJetBeginSessionA(instance, psesid, szUserName, szPassword);
        }

        return YY::Thunks::JetBeginSession(instance, psesid, szUserName, szPassword);
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    // 由于JetCreateInstanceA依赖于此函数编译, 故使用 < NTDDI_WIN6, 而不是 < NTDDI_WIN2K
    // Minimum supported server    Windows Server 2000
    __DEFINE_THUNK(
    esent,
    8,
    JET_ERR,
    JET_API,
    JetCreateInstance,
        _Out_ JET_INSTANCE* pinstance,
        _In_opt_ JET_PCSTR     szInstanceName
        )
    {
        if (auto const _pfnJetCreateInstance = try_get_JetCreateInstance())
        {
            return _pfnJetCreateInstance(pinstance, szInstanceName);
        }
        return JET_wrnNyi;
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    //Minimum supported client    Windows Vista
    //Minimum supported server    Windows Server 2008
    __DEFINE_THUNK(
    esent,
    8,
    JET_ERR,
    JET_API,
    JetCreateInstanceA,
        _Out_ JET_INSTANCE* pinstance,
        _In_opt_ JET_PCSTR     szInstanceName
        )
    {
        if (auto const _pfnJetCreateInstanceA = try_get_JetCreateInstanceA())
        {
            return _pfnJetCreateInstanceA(pinstance, szInstanceName);
        }
        return YY::Thunks::JetCreateInstance(pinstance, szInstanceName);
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    // 由于JetCreateInstanceA依赖于此函数编译, 故使用 < NTDDI_WIN6, 而不是 < NTDDI_WIN2K
    // Minimum supported server    Windows Server 2000
    __DEFINE_THUNK(
    esent,
    24,
    JET_ERR,
    JET_API,
    JetGetTableColumnInfo,
        _In_ JET_SESID                  sesid,
        _In_ JET_TABLEID                tableid,
        _In_opt_ JET_PCSTR             szColumnName,
        _Out_writes_bytes_(cbMax) void* pvResult,
        _In_ unsigned long              cbMax,
        _In_ unsigned long              InfoLevel
        )
    {
        if (auto const _pfnJetGetTableColumnInfo = try_get_JetGetTableColumnInfo())
        {
            return _pfnJetGetTableColumnInfo(sesid, tableid, szColumnName, pvResult, cbMax, InfoLevel);
        }
        return JET_wrnNyi;
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    // Minimum supported client    Windows Vista
    // Minimum supported server    Windows Server 2008
    __DEFINE_THUNK(
    esent,
    24,
    JET_ERR,
    JET_API,
    JetGetTableColumnInfoA,
        _In_ JET_SESID                  sesid,
        _In_ JET_TABLEID                tableid,
        _In_opt_ JET_PCSTR             szColumnName,
        _Out_writes_bytes_(cbMax) void* pvResult,
        _In_ unsigned long              cbMax,
        _In_ unsigned long              InfoLevel
        )
    {
        if (auto const _pfnJetGetTableColumnInfoA = try_get_JetGetTableColumnInfoA())
        {
            return _pfnJetGetTableColumnInfoA(sesid, tableid, szColumnName, pvResult, cbMax, InfoLevel);
        }
        return YY::Thunks::JetGetTableColumnInfo(sesid, tableid, szColumnName, pvResult, cbMax, InfoLevel);
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    // 由于JetOpenDatabaseA依赖于此函数编译, 故使用 < NTDDI_WIN6, 而不是 < NTDDI_WIN2K
    // Minimum supported server    Windows Server 2000
    __DEFINE_THUNK(
    esent,
    20,
    JET_ERR,
    JET_API,
    JetOpenDatabase,
        _In_ JET_SESID      sesid,
        _In_ JET_PCSTR     szFilename,
        _In_opt_ JET_PCSTR szConnect,
        _Out_ JET_DBID* pdbid,
        _In_ JET_GRBIT      grbit
        )
    {
        if (auto const _pfnJetOpenDatabase = try_get_JetOpenDatabase())
        {
            return _pfnJetOpenDatabase(sesid, szFilename, szConnect, pdbid, grbit);
        }
        return JET_wrnNyi;
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    // Minimum supported client    Windows Vista
    // Minimum supported server    Windows Server 2008
    __DEFINE_THUNK(
    esent,
    20,
    JET_ERR,
    JET_API,
    JetOpenDatabaseA,
        _In_ JET_SESID      sesid,
        _In_ JET_PCSTR     szFilename,
        _In_opt_ JET_PCSTR szConnect,
        _Out_ JET_DBID* pdbid,
        _In_ JET_GRBIT      grbit
        )
    {
        if (auto const _pfnJetOpenDatabaseA = try_get_JetOpenDatabaseA())
        {
            return _pfnJetOpenDatabaseA(sesid, szFilename, szConnect, pdbid, grbit);
        }
        return YY::Thunks::JetOpenDatabase(sesid, szFilename, szConnect, pdbid, grbit);
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    // 由于JetOpenTableA依赖于此函数编译, 故使用 < NTDDI_WIN6, 而不是 < NTDDI_WIN2K
    // Minimum supported server    Windows Server 2000
    __DEFINE_THUNK(
    esent,
    28,
    JET_ERR,
    JET_API,
    JetOpenTable,
        _In_ JET_SESID                                  sesid,
        _In_ JET_DBID                                   dbid,
        _In_ JET_PCSTR                                 szTableName,
        _In_reads_bytes_opt_(cbParameters) const void* pvParameters,
        _In_ unsigned long                              cbParameters,
        _In_ JET_GRBIT                                  grbit,
        _Out_ JET_TABLEID* ptableid
        )
    {
        if (auto const _pfnJetOpenTable = try_get_JetOpenTable())
        {
            return _pfnJetOpenTable(sesid, dbid, szTableName, pvParameters, cbParameters, grbit, ptableid);
        }
        return JET_wrnNyi;
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    // Minimum supported client    Windows Vista
    // Minimum supported server    Windows Server 2008
    __DEFINE_THUNK(
    esent,
    28,
    JET_ERR,
    JET_API,
    JetOpenTableA,
        _In_ JET_SESID                                  sesid,
        _In_ JET_DBID                                   dbid,
        _In_ JET_PCSTR                                 szTableName,
        _In_reads_bytes_opt_(cbParameters) const void* pvParameters,
        _In_ unsigned long                              cbParameters,
        _In_ JET_GRBIT                                  grbit,
        _Out_ JET_TABLEID* ptableid
        )
    {
        if (auto const _pfnJetOpenTableA = try_get_JetOpenTableA())
        {
            return _pfnJetOpenTableA(sesid, dbid, szTableName, pvParameters, cbParameters, grbit, ptableid);
        }
        return YY::Thunks::JetOpenTable(sesid, dbid, szTableName, pvParameters, cbParameters, grbit, ptableid);
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    // 由于JetSetSystemParameterA依赖于此函数编译, 故使用 < NTDDI_WIN6, 而不是 < NTDDI_WIN2K
    // Minimum supported server    Windows Server 2000
    __DEFINE_THUNK(
    esent,
    20,
    JET_ERR,
    JET_API,
    JetSetSystemParameter,
        _Inout_opt_ JET_INSTANCE* pinstance,
        _In_opt_ JET_SESID          sesid,
        _In_ unsigned long          paramid,
        _In_opt_ JET_API_PTR        lParam,
        _In_opt_ JET_PCSTR         szParam
        )
    {
        if (auto const _pfnJetSetSystemParameter = try_get_JetSetSystemParameter())
        {
            return _pfnJetSetSystemParameter(pinstance, sesid, paramid, lParam, szParam);
        }
        return JET_wrnNyi;
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    //Minimum supported client    Windows Vista
    //Minimum supported server    Windows Server 2008
    __DEFINE_THUNK(
    esent,
    20,
    JET_ERR,
    JET_API,
    JetSetSystemParameterA,
        _Inout_opt_ JET_INSTANCE* pinstance,
        _In_opt_ JET_SESID          sesid,
        _In_ unsigned long          paramid,
        _In_opt_ JET_API_PTR        lParam,
        _In_opt_ JET_PCSTR         szParam
        )
    {
        if (auto const _pfnJetSetSystemParameterA = try_get_JetSetSystemParameterA())
        {
            return _pfnJetSetSystemParameterA(pinstance, sesid, paramid, lParam, szParam);
        }
        return YY::Thunks::JetSetSystemParameter(pinstance, sesid, paramid, lParam, szParam);
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    // 由于JetGetSystemParameterA依赖于此函数编译, 故使用 < NTDDI_WIN6, 而不是 < NTDDI_WIN2K
    // Minimum supported server    Windows Server 2000
    __DEFINE_THUNK(
    esent,
    24,
    JET_ERR,
    JET_API,
    JetGetSystemParameter,
        _In_ JET_INSTANCE                   instance,
        _In_opt_ JET_SESID                  sesid,
        _In_ unsigned long                  paramid,
        _Out_opt_ JET_API_PTR* plParam,
        _Out_writes_bytes_opt_(cbMax) JET_PCSTR   szParam,
        _In_ unsigned long                  cbMax
        )
    {
        if (auto const _pfnJetGetSystemParameter = try_get_JetGetSystemParameter())
        {
            return _pfnJetGetSystemParameter(instance, sesid, paramid, plParam, szParam, cbMax);
        }
        return JET_wrnNyi;
    }
#endif

#if (YY_Thunks_Support_Version < NTDDI_WIN6)

    //Minimum supported client    Windows Vista
    //Minimum supported server    Windows Server 2008
    __DEFINE_THUNK(
    esent,
    24,
    JET_ERR,
    JET_API,
    JetGetSystemParameterA,
        _In_ JET_INSTANCE                   instance,
        _In_opt_ JET_SESID                  sesid,
        _In_ unsigned long                  paramid,
        _Out_opt_ JET_API_PTR* plParam,
        _Out_writes_bytes_opt_(cbMax) JET_PCSTR   szParam,
        _In_ unsigned long                  cbMax
        )
    {
        if (auto const _pfnJetGetSystemParameterA = try_get_JetGetSystemParameterA())
        {
            return _pfnJetGetSystemParameterA(instance, sesid, paramid, plParam, szParam, cbMax);
        }
        return YY::Thunks::JetGetSystemParameter(instance, sesid, paramid, plParam, szParam, cbMax);
    }
#endif

@mingkuang-Chuyu
Copy link
Collaborator

@lygstate esent.def 修正JetAddColumnA 是一个合理的选择,因为结合esent.lib以及esent.dll。我们可以确定现在JetAddColumnA@28JetAddColumn@28 等完全相同。

微软很少会突然更改公开的导出函数,暂时我认为没有必要特意为了这些事情写大量的Thunks函数。

@mingkuang-Chuyu
Copy link
Collaborator

mingkuang-Chuyu commented May 31, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants