Consultor Eletrônico



Kbase P131719: 4GL/ABL: The Working Directory of an AppServer session changes intermittently
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/21/2008
Status: Unverified

FACT(s) (Environment):

Windows
Progress 9.x
OpenEdge 10.x

SYMPTOM(s):

4GL/ABL: The Working Directory of an AppServer session changes intermittently

The application has no 4GL/ABL code to explicitly change the Working Directory of the AppServer session.

The application invokes one or more methods of an EXTERNAL C++ DLL Printing Utility.

The Working Directory changes to C:\WINDOWS\system32\spool\drivers\w32x86\3

CAUSE:

The EXTERNAL C++ DLL Printing Utility, under certain circumstances, changes the Working Directory of the AppServer session to C:\WINDOWS\system32\spool\drivers\w32x86\3.

FIX:

The ideal solution is to fix the C++ DLL Printing Utility and ensure that it never changes the Working Directory of an AppServer session.
A work around is to get the path of the Working Directory and store it in a CHARACTER variable before invoking the C++ DLL Printing Utility and reset it afterwards. For example:
DEFINE VARIABLE cWrkDir AS CHARACTER NO-UNDO.
DEFINE VARIABLE iResult AS INTEGER NO-UNDO.
/* 1. Save the Working Directory before invoking the Printing Utility : */
FILE-INFO:FILE-NAME = ".".
ASSIGN
cWrkDir = FILE-INFO:FULL-PATHNAME.
/* 2. Invoke the Printing Utility */
RUN PrintingUtility.
/* 3. Reset the Working Directory after invoking the Printing Utility : */
RUN SetCurrentDirectoryA (INPUT cWrkDir, OUTPUT iResult).
/* If setting the Working Directory failed. Log the failure */
IF iResult NE 1 THEN
MESSAGE "Failed to reset Working Directory"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
/* Dummy procedure to represent the C++ DLL Printing Utility */
PROCEDURE PrintingUtility:
/* The C++ DLL printing utility */
END.
/* Win32 API external DLL function call to reset the Working Directory */
PROCEDURE SetCurrentDirectoryA EXTERNAL "KERNEL32.DLL":
DEFINE INPUT PARAMETER ipcWrkDir AS CHARACTER.
DEFINE RETURN PARAMETER opiResult AS LONG.
END PROCEDURE.