I have extracted the following code from a program which
cycles through the dll's on a system to see which support
self registration. I noticed that the LoadLibrary API call
never returned on certain dll's. The section of code in the
If %False Then
...
End If
block below is an example. This code, when run on NT4 will
never return from the LoadLibrary call, no error return, no
return period. You cannot shut the program down from the task
manager. It even survives a logoff and relogin. I suspect the
framebuf.dll is running in a Ring 0 process and I am not allowed
the module handle, but never returning is harsh. Anybody know a
way to avoid such dll's?
Thanks for looking, Chuck
cycles through the dll's on a system to see which support
self registration. I noticed that the LoadLibrary API call
never returned on certain dll's. The section of code in the
If %False Then
...
End If
block below is an example. This code, when run on NT4 will
never return from the LoadLibrary call, no error return, no
return period. You cannot shut the program down from the task
manager. It even survives a logoff and relogin. I suspect the
framebuf.dll is running in a Ring 0 process and I am not allowed
the module handle, but never returning is harsh. Anybody know a
way to avoid such dll's?
Code:
#Compile Exe #Register None #Dim All $Include "win32Api.Inc" Function PbMain() Dim hMod As Long, ProcAddr As Long hMod = LoadLibrary("c:\winnt\system32\cryptui.dll") ' This works. MsgBox "hMod is " & Format$(hMod) If hMod <> 0 Then ProcAddr = GetProcAddress(hMod, "DllRegisterServer") MsgBox "ProcAddr is " & Format$(ProcAddr) FreeLibrary hMod Else MsgBox "LoadLibrary returned " & Format$(hMod) End If If %False Then ' If you change this you never return from LoadLibrary below. hMod = LoadLibrary("c:\winnt\system32\framebuf.dll") ' This never comes back. MsgBox "hMod is " & Format$(hMod) If hMod <> 0 Then ProcAddr = GetProcAddress(hMod, "DllRegisterServer") MsgBox "ProcAddr is " & Format$(ProcAddr) FreeLibrary hMod Else MsgBox "LoadLibrary returned " & Format$(hMod) End If End If End Function
Comment