News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Windows 10: LoadLibrary fails with error 126

Started by jj2007, November 25, 2021, 12:37:31 AM

Previous topic - Next topic

jj2007

Looks simple, right? Both DLLs get loaded in Win7-64, but on my new Win10 machine Unzip32 fails with "module not found", error 126. They look fine in PEView. Source and DLLs attached... any ideas?

include \masm32\include\masm32rt.inc ; plain Masm32 for the fans of pure assembler

.code
start:
  print "testing two Dlls", 13, 10
  invoke LoadLibrary, chr$("Unzip32.dll")
  print str$(eax), " for Unzip32.dll", 9
  print LastError$()
  invoke LoadLibrary, chr$("Zip32.dll")
  print str$(eax), " for Zip32.dll  ", 9
  print LastError$()
  inkey "hit any key"
  exit

end start


P.S.: Unzip32.dll from here works :cool:

fearless


TimoVJL

#2
Have you MSVCR100.dll in your Windows 10, i don't

Attached a unzip32.dll, msvcrt.dll version from HP.


Depends.exe might work in Windows 10 ?

WPEImpLstT164.exe can be helpful too  :smiley:
May the source be with you

jj2007

Thanks, fearless & Timo. I will look into it again tonight...

wjr

Just checking, does LoadLibrary return NULL or a valid handle? With that sample code on Win7-64 I get non-NULL return values, but a different 'error' message for the first one. If LoadLibrary does not call SetLastError with 0 upon success, it may look like a 'fail' with that sample code.

jj2007

Quote from: wjr on November 25, 2021, 04:43:20 AM
Just checking, does LoadLibrary return NULL or a valid handle? With that sample code on Win7-64 I get non-NULL return values, but a different 'error' message for the first one. If LoadLibrary does not call SetLastError with 0 upon success, it may look like a 'fail' with that sample code.

It returns a valid handle on Win7-64 but ZERO on Win-10, together with error 126 aka "module not found"

Quote from: TimoVJL on November 25, 2021, 01:17:05 AM
Have you MSVCR100.dll in your Windows 10, i don't

Even with MSVCR100.dll, the older DLL fails.

LiaoMi

Quote from: jj2007 on November 25, 2021, 12:37:31 AM
Looks simple, right? Both DLLs get loaded in Win7-64, but on my new Win10 machine Unzip32 fails with "module not found", error 126. They look fine in PEView. Source and DLLs attached... any ideas?

include \masm32\include\masm32rt.inc ; plain Masm32 for the fans of pure assembler

.code
start:
  print "testing two Dlls", 13, 10
  invoke LoadLibrary, chr$("Unzip32.dll")
  print str$(eax), " for Unzip32.dll", 9
  print LastError$()
  invoke LoadLibrary, chr$("Zip32.dll")
  print str$(eax), " for Zip32.dll  ", 9
  print LastError$()
  inkey "hit any key"
  exit

end start


P.S.: Unzip32.dll from here works :cool:

Hi jj2007,

Windows 10 Ent 21h1

testing two Dlls
2009661440 for Unzip32.dll      The requested lookup key was not found in any active activation context.
268435456 for Zip32.dll         The operation completed successfully.
hit any key

https://rammerlabs.alidml.ru/index-eng.html
https://rammerlabs.alidml.ru/files/0206-2237-B0D4-283F/PEAnatomist-0.2.6.zip

You can compare what functions are in your runtime
MSVCR100.dll ???

Unzip32.dll IAT
73 0x15124 0x19A7C I: MSVCR100.dll ___mb_cur_max_func
74 0x15128 0x19A92 I: MSVCR100.dll fgets
75 0x1512C 0x19A9A I: MSVCR100.dll __iob_func
76 0x15130 0x19AA8 I: MSVCR100.dll _mbschr
77 0x15134 0x19AB2 I: MSVCR100.dll _lseeki64
78 0x15138 0x19ABE I: MSVCR100.dll qsort
79 0x1513C 0x19AC6 I: MSVCR100.dll _localtime64
80 0x15140 0x19AD6 I: MSVCR100.dll _mktime64
81 0x15144 0x19AE2 I: MSVCR100.dll _time64
82 0x15148 0x19AEC I: MSVCR100.dll strerror
83 0x1514C 0x19AF8 I: MSVCR100.dll _errno
84 0x15150 0x19B02 I: MSVCR100.dll fopen
85 0x15154 0x19B0A I: MSVCR100.dll rename
86 0x15158 0x19B14 I: MSVCR100.dll longjmp
87 0x1515C 0x19B1E I: MSVCR100.dll fflush
88 0x15160 0x19B28 I: MSVCR100.dll putc
89 0x15164 0x19B30 I: MSVCR100.dll tolower
90 0x15168 0x19B3A I: MSVCR100.dll isupper
91 0x1516C 0x19B44 I: MSVCR100.dll strncpy
92 0x15170 0x19B4E I: MSVCR100.dll _gmtime64
93 0x15174 0x19B5A I: MSVCR100.dll _get_osfhandle
94 0x15178 0x19B6C I: MSVCR100.dll isalpha
95 0x1517C 0x19B76 I: MSVCR100.dll strncmp
96 0x15180 0x19B80 I: MSVCR100.dll _mbsrchr
97 0x15184 0x19B8C I: MSVCR100.dll _stat64
98 0x15188 0x19B96 I: MSVCR100.dll strncat
99 0x1518C 0x19BA0 I: MSVCR100.dll fclose
100 0x15190 0x19BAA I: MSVCR100.dll isdigit
101 0x15194 0x19BB4 I: MSVCR100.dll fprintf
102 0x15198 0x19BBE I: MSVCR100.dll _msize
103 0x1519C 0x19BC8 I: MSVCR100.dll strchr
104 0x151A0 0x19BD2 I: MSVCR100.dll setlocale
105 0x151A4 0x19BDE I: MSVCR100.dll toupper
106 0x151A8 0x19BE8 I: MSVCR100.dll iscntrl
107 0x151AC 0x19C00 I: MSVCR100.dll _malloc_crt
108 0x151B0 0x19C0E I: MSVCR100.dll _encoded_null
109 0x151B4 0x19C1E I: MSVCR100.dll _initterm
110 0x151B8 0x19C2A I: MSVCR100.dll _initterm_e
111 0x151BC 0x19C38 I: MSVCR100.dll _amsg_exit
112 0x151C0 0x19C46 I: MSVCR100.dll __CppXcptFilter
113 0x151C4 0x19C58 I: MSVCR100.dll _crt_debugger_hook
114 0x151C8 0x19C6E I: MSVCR100.dll __clean_type_info_names_internal
115 0x151CC 0x19C92 I: MSVCR100.dll _unlock
116 0x151D0 0x19C9C I: MSVCR100.dll __dllonexit
117 0x151D4 0x19CAA I: MSVCR100.dll _lock
118 0x151D8 0x19CB2 I: MSVCR100.dll _onexit
119 0x151DC 0x19CBC I: MSVCR100.dll _except_handler4_common
120 0x151E0 0x19A72 I: MSVCR100.dll isprint
121 0x151E4 0x19A68 I: MSVCR100.dll _mbsinc
122 0x151E8 0x19A5E I: MSVCR100.dll _mbclen
123 0x151EC 0x19A54 I: MSVCR100.dll sprintf
124 0x151F0 0x19A4A I: MSVCR100.dll memset
125 0x151F4 0x19A34 I: MSVCR100.dll realloc
126 0x151F8 0x19A2A I: MSVCR100.dll memcpy
127 0x151FC 0x19A20 I: MSVCR100.dll malloc
128 0x15200 0x19A18 I: MSVCR100.dll free
129 0x15204 0x19E50 I: MSVCR100.dll _strupr
130 0x15208 0x19E5A I: MSVCR100.dll _mkdir
131 0x1520C 0x19E64 I: MSVCR100.dll _write
132 0x15210 0x19A3E I: MSVCR100.dll _setjmp3
133 0x15214 0x19DEE I: MSVCR100.dll _setmode
134 0x15218 0x19DFA I: MSVCR100.dll _fileno
135 0x1521C 0x19E04 I: MSVCR100.dll _read
136 0x15220 0x19E0C I: MSVCR100.dll _open
137 0x15224 0x19E14 I: MSVCR100.dll _chmod
138 0x15228 0x19E1E I: MSVCR100.dll _unlink
139 0x1522C 0x19E28 I: MSVCR100.dll _isatty
140 0x15230 0x19E32 I: MSVCR100.dll _close
141 0x15234 0x19E3C I: MSVCR100.dll _tzset
142 0x15238 0x19E46 I: MSVCR100.dll _putenv
143 0x1523C 0x19E6E I: MSVCR100.dll _strnicmp



jj2007

Thanks to all of you :thup:

I'll stick to this one: newer, less than half the size, and almost no dependencies :thumbsup:

Quote from: jj2007 on November 25, 2021, 12:37:31 AMP.S.: Unzip32.dll from here works :cool:

hutch--

This thread has surprised me in that I have use LoadLibrary() and GetProcAddress() for years with no problems at all. What happens if you make an IMPORT library and call the functions that way ?

TimoVJL

While ago ntwdblib.dll stopped working in local network after Windows 10 updates, but luckily local copy works, so Windows 10 have secrets, internal list of known dlls.
May the source be with you

jj2007

#10
Quote from: hutch-- on November 26, 2021, 02:38:19 AM
This thread has surprised me in that I have use LoadLibrary() and GetProcAddress() for years with no problems at all.

Me too :biggrin:

QuoteWhat happens if you make an IMPORT library and call the functions that way ?

Works on Win7-64 with the old Unzip32.dll, but on Win10 I get "Cannot execute because Unzip32.dll could not be found". Which is the usual misleading crap from Micros**t because the DLL is there, and if I comment out these lines, it runs just fine:
; \masm32\bin\polib.exe /OUT:uz32.lib /MACHINE:x86 Unzip32.dll
externdef _imp__UzpVersion:PTR c_msvcrt
UzpVersion equ <_imp__UzpVersion>
includelib ZipDll\Uz32.lib
; UzpVersion PROTO
invoke UzpVersion ; Unresolved external symbol '_UzpVersion@0'
print str$(eax), " is the version", 13, 10


HSE

Quote from: TimoVJL on November 26, 2021, 03:27:06 AM
so Windows 10 have secrets, internal list of known dlls.

Apparently Win10 requiere to use Regsvr32, say module is charged but don't find entry point.

I manually charge Resguard.dll (is 32 bits) in SysWow64 and no more problem  :biggrin:
Equations in Assembly: SmplMath

hutch--

Ah, I think I get what the problem is, Microsoft are playing "musical chairs" with at least some DLL locations as it uses a virtual machine to manage 32 bit apps in a 64 bit OS. Whereas the last reliable 32 bit version had a one to one interface with its DLLs, in Win64 its like a magical mystery tour.

I have tended to stick to what could be routinely found in 32 bit as at least I knew what it was supposed to do, the 64 bit re-writes usually work OK which means you can usually use WIN32.HLP for old API reference.

jj2007

Quote from: HSE on December 01, 2021, 07:55:14 AM
Quote from: TimoVJL on November 26, 2021, 03:27:06 AM
so Windows 10 have secrets, internal list of known dlls.

Apparently Win10 requiere to use Regsvr32, say module is charged but don't find entry point.

I tested that with the older Unzip32.dll, and it fails on Win10 for regsvr32 Unzip32.dll with "cannot load the module"