Ir al contenido principal

Recuperar valores binarios del registro de windows desde Progress empleando el api advapi32.dll

Con este programa si se puede recuperar el valor binario de un registro de windows

DEFINE VARIABLE SubKey AS CHARACTER NO-UNDO.
DEFINE VARIABLE qKey AS CHARACTER NO-UNDO.
DEFINE VARIABLE hKey AS INTEGER NO-UNDO.
DEFINE VARIABLE bufSize AS INTEGER NO-UNDO.
DEFINE VARIABLE res AS INTEGER NO-UNDO.
DEFINE VARIABLE hKeyResult AS INTEGER NO-UNDO.
DEFINE VARIABLE lpData AS MEMPTR NO-UNDO.
DEFINE VARIABLE dataType AS INTEGER NO-UNDO.
DEFINE VARIABLE SamDesired AS INTEGER NO-UNDO.
&GLOBAL-DEFINE HKEY_CURRENT_USER -2147483647.
&GLOBAL-DEFINE HKEY_LOCAL_MACHINE -2147483646.
&GLOBAL-DEFINE HKEY_CURRENT_CONFIG -2147483643.
&GLOBAL-DEFINE HKEY_CLASSES_ROOT -2147483648.
&GLOBAL-DEFINE KEY_QUERY_VALUE 1 .
/* Initialization */
hKey = {&HKEY_CURRENT_USER} .
SamDesired = {&KEY_QUERY_VALUE} .
SubKey = "Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders".
qKey = "Personal".
bufSize = 255.
SET-SIZE(lpData) = bufSize .
/* Opens the specified key */
RUN RegOpenKeyExA (
        INPUT hKey, /* handle of open key */
        INPUT SubKey, /* name of subkey to open */
        INPUT 0, /* reserved */
        INPUT SamDesired, /* security access mask */
        OUTPUT hKeyResult, /* handle of open key */
        OUTPUT res).
/* Retrieves data for a specified value name
associated with an open registry key */
RUN RegQueryValueExA (
        INPUT hKeyResult, /* handle of key to query */
        INPUT qKey, /* name of value to query */
        INPUT 0, /* reserved */
        OUTPUT datatype, /* address of buffer for value type */
        GET-POINTER-VALUE(lpData), /* address of data buffer */
        OUTPUT bufSize, /* data buffer size */
        OUTPUT res).
/* Releases the handle of the specified key */
RUN RegCloseKey (
        INPUT hKeyResult, /* handle of key to close */
        OUTPUT res).
MESSAGE qKey ": " GET-STRING(lpData, 1) VIEW-AS ALERT-BOX.
/* ********* Procedure definitions ********* */
PROCEDURE RegOpenKeyExA EXTERNAL "advapi32" :
        DEFINE INPUT PARAMETER hkey AS LONG.
        DEFINE INPUT PARAMETER lpSubKey AS CHARACTER.
        DEFINE INPUT PARAMETER ulOptions AS LONG.
        DEFINE INPUT PARAMETER samDesired AS LONG.
        DEFINE OUTPUT PARAMETER phkResult AS LONG.
        DEFINE RETURN PARAMETER RetResult AS LONG.
END PROCEDURE.
PROCEDURE RegQueryValueExA EXTERNAL "advapi32" :
        DEFINE INPUT PARAMETER hkey AS LONG.
        DEFINE INPUT PARAMETER lpValueName AS CHARACTER.
        DEFINE INPUT PARAMETER lpdwReserved AS LONG.
        DEFINE OUTPUT PARAMETER lpdwType AS LONG.
        DEFINE INPUT PARAMETER lpbData AS LONG.
        DEFINE OUTPUT PARAMETER lpcbData AS LONG.
        DEFINE RETURN PARAMETER lpresult AS LONG.
END PROCEDURE.
PROCEDURE RegCloseKey EXTERNAL "advapi32" :
        DEFINE INPUT PARAMETER hkey AS LONG.
        DEFINE RETURN PARAMETER lpresult AS LONG.
END PROCEDURE.

Comentarios

Entradas populares de este blog

Email directly from 4GL - V9.1/3.1 only

/*------------------------------------------------------------------- File........: smtpmail.p Version.....: 5.8c - Feb 25, 2009 Description : Opens up an SMTP connection and sends an email message to multiple recipients. Input Param : mailhub char - settable SMTP server name/IP address optionally append :XX where X is a port number of the SMTP server. 25 is default port. EmailTo CHAR - list of email addresses separated by semicolons or commas (All semicolons will be replaced by commas so don't include stuff like Smith, John) <me@myaddress.org>"My Name" EmailFrom CHAR - email address of user originating the email, the SMTP server should require that this user is real. Format looks like: <user>@<host>[;<descriptive name>][^replytouser>@<replytohost] ...

Progress Explorer Tool en Windows Server 2008

Al intentar abrir el Progress Explorer Tool en Windows 2008 Server este regresa un mensaje  este es un post en ingles ubicado en  http://alasdaircs.wordpress.com/2011/02/17/progress-explorer-and-windows-2008/ gracias a alasdairc por compartirlo Para solucionar el problema basta con modificar el registro a los valores mostrados a continuacion. [HKEY_CURRENT_USER\Software\Microsoft\Java VM] “EnableLogging”=hex:00,00,00,00 “EnableJIT”=hex:00,00,00,00 [HKEY_USERS\.Default\Software\Microsoft\Java VM] “EnableLogging”=hex:00,00,00,00 “EnableJIT”=hex:00,00,00,00

Editar PL files

Los archivos .pl en progress son progress library pueden contener tanto codigo fuente como programas compilados. En la siguiente ruta pueden localizar una herramienta para examinar el contenido de estos archivos. http://progress-tools.x10.mx/winpl.html Winpl