SetupVerifyInfFile returns ERROR_INVALID_PARAMETER (0x57) for windows xp

556 views Asked by At

This code successfully works on Vista/Win7, but it fails on win xp (returns ERROR_INVALID_PARAMETER). There're no docs in internet about this problem. Does anybody know where the mistake is? Thanks.

QList<std::pair<int, int> > versions;
versions << std::pair<int, int>(5, 0);
versions << std::pair<int, int>(5, 1);
versions << std::pair<int, int>(5, 2);
versions << std::pair<int, int>(6, 0);
versions << std::pair<int, int>(6, 1);

QList<int> architectures;
architectures << PROCESSOR_ARCHITECTURE_INTEL << PROCESSOR_ARCHITECTURE_AMD64;

for (int i = 0; i < versions.count(); i++)
{
    int major = versions[i].first;
    int minor = versions[i].second;

    for (int j = 0; j < architectures.count(); j++)
    {
        int arch = architectures[j];

        SP_INF_SIGNER_INFO_V2 signerInfo;
        signerInfo.cbSize = sizeof(SP_INF_SIGNER_INFO_V2);

        SP_ALTPLATFORM_INFO_V2 altPlatInfo;
        altPlatInfo.cbSize = sizeof(SP_ALTPLATFORM_INFO_V2);
        altPlatInfo.Platform = VER_PLATFORM_WIN32_NT;
        altPlatInfo.MajorVersion = major;
        altPlatInfo.MinorVersion = minor;
        altPlatInfo.Flags = SP_ALTPLATFORM_FLAGS_VERSION_RANGE;
        altPlatInfo.FirstValidatedMajorVersion = major;
        altPlatInfo.FirstValidatedMinorVersion = minor;
        altPlatInfo.ProcessorArchitecture = arch;
        SP_INF_SIGNER_INFO_V2 signerInfo;
        signerInfo.cbSize = sizeof(SP_INF_SIGNER_INFO_V2);

        bool result = SetupVerifyInfFile((wchar_t*)package.infFilePath.utf16(), 0, &signerInfo);
1

There are 1 answers

0
Manos Nikolaidis On

I also couldn't get the UNICODE version of SetupVerifyInfFile to work on XP. Non-Unicode version works fine. If package.infFilePath only contains ASCII you may use use this workaround:

SP_INF_SIGNER_INFO_V2_A signerInfo;
signerInfo.cbSize = sizeof(SP_INF_SIGNER_INFO_V2_A);
bool result = SetupVerifyInfFileA(package.infFilePath.toUtf8(), 0, &signerInfo);