Changeset 8693


Ignore:
Timestamp:
Jun 16, 2002, 10:20:16 AM (23 years ago)
Author:
sandervl
Message:

Expand string when converting REG_EXPAND_SZ to REG_SZ

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/kernel32/registry.cpp

    r8687 r8693  
    1 /* $Id: registry.cpp,v 1.16 2002-06-15 17:16:06 sandervl Exp $ */
     1/* $Id: registry.cpp,v 1.17 2002-06-16 08:20:16 sandervl Exp $ */
    22
    33/*
     
    10331033 *****************************************************************************/
    10341034
    1035 LONG WIN32API RegSetValueExA(HKEY  hkey,
    1036                              LPCSTR  lpszValueName,
     1035LONG WIN32API RegSetValueExA(HKEY   hkey,
     1036                             LPCSTR lpszValueName,
    10371037                             DWORD  dwReserved,
    10381038                             DWORD  fdwType,
     
    10401040                             DWORD  cbData)
    10411041{
     1042  LPSTR lpszExpandedString = NULL;
     1043  LONG  ret;
     1044
    10421045  if(fdwType == REG_SZ || fdwType == REG_EXPAND_SZ) {
    10431046    dprintf(("ADVAPI32: RegSetValueExA)%08xh,%s,%08xh,%08xh,%s,%08xh)",
     
    10621065      dprintf(("!WARNING!: REG_EXPAND_SZ converted to REG_SZ"));
    10631066      fdwType = REG_SZ; //registry.dll doesn't like this type
     1067
     1068      //Expand string
     1069      lpszExpandedString = (LPSTR)malloc(cbData);
     1070      if(lpszExpandedString == NULL) {
     1071          DebugInt3();
     1072          return ERROR_NOT_ENOUGH_MEMORY;
     1073      }
     1074      ExpandEnvironmentStringsA((LPSTR)lpbData, lpszExpandedString, cbData);
     1075      lpbData = (BYTE *)lpszExpandedString;
     1076      cbData  = strlen(lpszExpandedString)+1;
     1077      dprintf(("Expanded to: %s", lpszExpandedString));
    10641078  }
    1065   return O32_RegSetValueEx(ConvertKey(hkey),
    1066                            lpszValueName,
    1067                            dwReserved,
    1068                            fdwType,
    1069                            lpbData,
    1070                            cbData);
     1079  ret = O32_RegSetValueEx(ConvertKey(hkey), lpszValueName, dwReserved,
     1080                          fdwType, lpbData, cbData);
     1081
     1082  if(lpszExpandedString) free(lpszExpandedString);
     1083
     1084  return ret;
    10711085}
    10721086
Note: See TracChangeset for help on using the changeset viewer.