LoadLibrary: The specified procedure could not be found

◇◆丶佛笑我妖孽 提交于 2021-02-11 05:55:33

问题


I need to extract some things about system process in a windows 2003 server (yeah, in 2019), I made that code in python, and compiled it with auto_py_to_exe

When I run the .exe file on the server, I recevbe an error saying "LoadLibrary: The specified procedure could not be found." referring to python37.dll

I try to compile like one directory (with the specific dll included), and I try to compile like one file, and I get the following output.


回答1:


There'a too big gap between Python 3.7 and Win 2003. Looking at [Python.Wiki]: WindowsCompilers Python 3.7 is not even listed there (as it's built with VStudio 2017). That, (and Python itself) will require / call functions that are not present in Win 2003 system .dlls.

Here's an example. In the images below I opened 2 versions' (2.7 and 3.7) main .dll with Dependency Walker:

As seen, both import a bunch of functions from kernel32.dll. But one difference is that python37.dll imports GetTickCount64. According to [MS.Docs]: GetTickCount64 function, the minimum Server version that supports it is Win 2008, meaning that it won't work in Win 2003.

So, you'd have to go way back to python 2.7 (tops). A number of years ago, I've built Python 2.7.10 with VStudio 2010 and it worked on Win 2003 (and XP SP 1); most likely, this also applies to the newest (2.7) version.

Note that you'll also have to install all the packages that you use in your script (including auto-py-to-exe).

@EDIT0:

I remembered (and just checked) that I have Python 3.4.3 on my XP (SP 3) PC. So, there's high chance that Python 3 (prior to 3.5) will work on Win 2003 as well.

@EDIT1:

Finally, I have some official statement: On Python official page, hovering the mouse over the "Download" button yields:

Note that Python 3.5+ cannot be used on Windows XP or earlier.

or (even clearer):

Note that it doesn't necessarily mean that older versions are guaranteed to work. So, you'll need to do a bit of testing (I'd recommend installing Python and required packages on the target machine, and only when everything is successful, package everything).

@EDIT2:

I mentioned that I've built a Python2.7 version. psutil was part of it.

>>> import sys, platform, psutil
>>> sys.version, sys.platform
('2.7.10 (default, Mar  8 2016, 15:08:43) [MSC v.1600 32 bit (Intel)]', 'win32')
>>> platform.platform()
'Windows-XP-5.1.2600-SP3'
>>> psutil.__version__
'3.1.1'

I didn't mention that I've built psutil from sources, but the prebuilt .whls and also Win installers are available for download: [PyPI]: psutil 3.1.1 - Download files.




回答2:


finally i used python 2.7.9 and py2exe, it solved, but PSutil its not compatible whit windows 2003 server :c



来源:https://stackoverflow.com/questions/54188308/loadlibrary-the-specified-procedure-could-not-be-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!