Unable to locate program input point k32getmoduleinformation on dynamic link library KERNEL32.dll

Source: Internet
Author: User
Tags thread class
Preface

vs2013 compiled program, run on WinXP.
Changed the tool chain to XP, using the static MFC library.
Run on XP escalation error: Unable to locate program input point k32getmoduleinformation on dynamic link library KERNEL32.dll

HTTP://WWW.VCERROR.COM/?P=2113 on the data said to add a macro #define PSAPI_VERSION 1

It's good to run now, but the getmoduleinformation is invalid.
Still want to change a VC6 version, run on XP ...
Experiment, the patch and PSDK VC6 on WinXP compile, add getmoduleinformation can be compiled. As long as the bag psapi.h, PSAPI.lib on the line.

                    TCHAR Szbuf[max_path] = {_t ('} ')};
                    DWORD DWRC = 0;
                    HANDLE hprocess = OpenProcess (process_all_access, FALSE, Pe32.th32processid);
                        if (hprocess) {findprocessdepends (hprocess);
                        DWRC = Getmodulefilenameex (hprocess, Me32.hmodule, szbuf, sizeof (SZBUF)/sizeof (TCHAR));
                        if (0! = DWRC) {outputdebugstring (SZBUF);
                        } zeromemory (&modinfo, sizeof (Moduleinfo));
                            BRc = Getmoduleinformation (hprocess, Me32.hmodule, &modinfo,
                        sizeof (Moduleinfo)); if (bRc) {listrowdata.m_dwentrypoint = (DWORD) modinfo.
                        entrypoint;
 } closehandle (hprocess);
PostScript

Experiment, the project from vs2013 to VC6 version, compiled through, change thread class for AfxBeginThread, run normally.
Background thread made with __beginthread in vs2013, can get afxgetapp. But not in VC6.
If you want to take a pointer to an MFC object in a VC6 thread, this thread must be a afxbeginthread-initiated thread.

The original demo is VC6, and later because PSDK too late to install (also may not be found at the time), in order to finish quickly, directly turned into a VS2013.
Now back to VC6, still smooth. If the turn is not smooth, then it is a disadvantage.

The simplest way to turn the project back to VC6 is to create a project with the same name, the project file, the main class (e.g. Cmainapp, CMainFrame, CMainView, Cmaindoc) are all the same. The VS2013 works are then covered in the VC6 project, except for files (. h,. cpp,. RC, including useful subdirectories) in the project. Compile, eliminate errors (e.g. message-handling functions are slightly different), eliminating the run-time error (e.g. VS2013 project using a _beginthread-initiated thread), it's done. If the VS2013 project does not use VS2013 classes or classes that are required for the VS environment, the conversion process is ^^ smoothly.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.