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

MemoryGetProcAddress fails to import a function by ordinal number if dll has no exported names #98

Open
leo-liu opened this issue May 14, 2020 · 1 comment

Comments

@leo-liu
Copy link

leo-liu commented May 14, 2020

I debugged the function and noticed:

    if (exports->NumberOfNames == 0 || exports->NumberOfFunctions == 0) {
        // DLL doesn't export anything
        SetLastError(ERROR_PROC_NOT_FOUND);
        return NULL;
    }

A dll may have no exported names, but has a set of private exported functions with no expoted names. Thus, NumberOfNames == 0 while NumberOfFunctions > 0 cannot impliy that DLL doesn't export anything.

Maybe the code above should be changed to

    if (exports->NumberOfFunctions == 0) {
        // DLL doesn't export anything
        SetLastError(ERROR_PROC_NOT_FOUND);
        return NULL;
    }
@Elmue
Copy link

Elmue commented Jun 22, 2020

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

No branches or pull requests

2 participants