Kbase P49572: How to get the PID in _Connect to match the getCurrentProcessId
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Unverified
GOAL:
How to get the PID in _Connect to match the getCurrentProcessId
GOAL:
In version8 of Progress there was a bug in that the 16 bit part of the PID was being stored in the _Connect table so for some Operating Systems (Win95/98) this meant that the value in _Connect did not match that in getCurrentProcessId
FACT(s) (Environment):
Progress 8.x
FIX:
To get the value stored in _Connect to match that in getCurrentProcessId the following code should work:
PROCEDURE GetCurrentProcessId EXTERNAL "kernel32.dll":U:
DEFINE RETURN PARAMETER PID AS LONG.
END PROCEDURE.
DEFINE VARIABLE vPID AS INTEGER NO-UNDO.
vPID = GetCurrentProcessId.
vPID = (2147483648.0 + vPID) MOD 65536.
/* 2^31 + vPID to have unsigned PID, MOD 65536 to have 16 bits part */
IF vPID > 32748 THEN
/* the 16 bits part stored in _connect is signed */
vPID = vPID - 65536.