m.cKeyValue = LEFT(m.lpbData,m.lpcbData-1)You did correct me... I needed to replace the lnCharReturned variable with m.lpcbData to properly trim the expanded string.
m.lpcbData = ExpandEnvironmentStrings(m.lpbData, @lcExpandedString, 1000)>Small correction
lnCharReturned = ExpandEnvironmentStrings(m.lpbData, @lcExpandedString, 1000) >* m.lpbData = m.lcExpandedString > m.lpbData = LEFT(m.lcExpandedString, lnCharReturned-1)>You can also use WSH
oShell = CreateObject("WScript.Shell") >m.lpbData = oShell.ExpandEnvironmentStrings(m.lpbData) >>>
>> DECLARE LONG ExpandEnvironmentStrings IN Win32API ; >> STRING cSrc, STRING @cDst, LONG nSize >>>>
>>* 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 >>>>