Kbase P142051: 4GL/ABL: How to programmatically check whether PROEXEC.DLL is registered?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  4/18/2011 |
|
Status: Verified
GOAL:
4GL/ABL: How to programmatically check whether PROEXEC.DLL is registered?
GOAL:
How to determine whether a WIN32 Dynamic Link Library is registered or not?
GOAL:
How to call the WIN32 API LoadLibraryA and FreeLibrary functions?
GOAL:
What are the WIN32 API LoadLibraryA Error Codes?
FACT(s) (Environment):
Windows
Progress 9.x
OpenEdge 10.x
FIX:
The following code checks whether the specified PROEXEC.DLL is registered or not. The WIN32 API function LoadLibrary loads a DLL and returns either a handle or an error code. If the return value is less than 32, it indicates one of the errors listed below. A return value greater than or equal to 32 indicates success and the FreeLibrary function is called to unload the library.
LoadLibrary Error Codes
0 System was out of memory, executable file was corrupt, or relocations were invalid.
2 File was not found.
3 Path was not found.
5 Attempt was made to dynamically link to a task, or there was a sharing or network-protection error.
6 Library required separate data segments for each task.
8 There was insufficient memory to start the application.
10 Windows version was incorrect.
11 Executable file was invalid. Either it was not a Windows application or there was an error in the .EXE image.
12 Application was designed for a different operating system.
13 Application was designed for MS-DOS 4.0.
14 Type of executable file was unknown.
15 Attempt was made to load a real-mode application (developed for an earlier version of Windows).
16 Attempt was made to load a second instance of an executable file containing multiple data segments that were not marked read-only.
19 Attempt was made to load a compressed executable file. The file must be decompressed before it can be loaded.
20 Dynamic-link library (DLL) file was invalid. One of the DLLs required to run this application was corrupt.
21 Application requires Microsoft Windows 32-bit extensions.
DEFINE VARIABLE cLibraryName AS CHARACTER NO-UNDO.
DEF VAR hLibrary AS INTEGER NO-UNDO.
ASSIGN
cLibraryName = "C:\Progress\OpenEdge101B\bin\PROEXEC.DLL".
RUN LoadLibraryA(cLibraryName, OUTPUT hLibrary).
IF hLibrary GE 32 THEN
MESSAGE hLibrary cLibraryName " is properly registered"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
ELSE
MESSAGE hLibrary cLibraryName " is NOT properly registered"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
RUN FreeLibrary(INPUT hLibrary).
PROCEDURE LoadLibraryA EXTERNAL "KERNEL32.DLL":U :
DEFINE INPUT PARAMETER dllname AS CHARACTER.
DEFINE RETURN PARAMETER hdll AS LONG.
END.
PROCEDURE FreeLibrary EXTERNAL "KERNEL32.DLL":U :
DEFINE INPUT PARAMETER hdll AS LONG.
END.