Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Registry.prg - CLASS filereg's GetAppPath PROCEDURE
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00661519
Message ID:
00661800
Vues:
34
Ed,

After a search on MSDN I found the ExpandEnvironmentStrings function.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/sysinfo_4ysz.asp

I added the Declare to the LoadRegFuncs procedure
  DECLARE LONG ExpandEnvironmentStrings IN Win32API ;
    STRING cSrc, STRING @cDst, LONG nSize
Modified the GetKeyValue procedure
* wrd-bds - 05/27/2002 added code to expand REG_EXPAND_SZ value types
  DO CASE
    CASE lpdwType = REG_EXPAND_SZ
      LOCAL lcExpandedString,lnCharReturned
      lcExpandedString = SPACE(1000)
      lnCharReturned = ExpandEnvironmentStrings(m.lpbData, @lcExpandedString, 1000)
      m.lpbData = m.lcExpandedString

    CASE lpdwType # REG_SZ
      RETURN ERROR_NONSTR_DATA

  ENDCASE

* Make sure we have a data string data type
*!*      IF lpdwType # REG_SZ
*!*        RETURN ERROR_NONSTR_DATA
*!*      ENDIF
And I am good to go.

>>It seems pretty straightforward to write a method to evaluate any REG_EXPAND_SZ value type since the variables are surrounded by %variable_name%.
>>
>
>AFAIK, there's nothing in the FFC registry class or REGISTRY.PRG to handle anything except REG_SZ key values. I've written more generalized routines before to handle various data types - it basically involves retrieving the value type in the API call as well as a buffer large enough to handle any possible binary return (REG_MULTI_SZ and REG_DWORD, for example, may contain embedded nulls that would falsely terminate a C-String.)
>
>>Does an updated version of registry.prg already exist that returns REG_SZ and REG_EXPAND_SZ value types? If not does a complete list of registry variables exist? How do I retrieve the values for these variables?
>
>The complete list of REG_EXPAND_SZ values is impossible to create, since -any- environment variable can (and often is) used in REG_EXPAND_SZ key values.
Heavy Metal Pedal - click with care
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform