[ros-dev] [ros-diffs] [janderwald] 39459: - Add a hack

Timo Kreuzer timo.kreuzer at web.de
Sat Feb 7 23:41:03 CET 2009


Very descriptive commit message ;-)


janderwald at svn.reactos.org schrieb:
> Author: janderwald
> Date: Sat Feb  7 09:43:14 2009
> New Revision: 39459
>
> URL: http://svn.reactos.org/svn/reactos?rev=39459&view=rev
> Log:
> - Add a hack
>
> Modified:
>     trunk/reactos/base/system/services/config.c
>     trunk/reactos/base/system/services/rpcserver.c
>
> Modified: trunk/reactos/base/system/services/config.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/config.c?rev=39459&r1=39458&r2=39459&view=diff
> ==============================================================================
> --- trunk/reactos/base/system/services/config.c [iso-8859-1] (original)
> +++ trunk/reactos/base/system/services/config.c [iso-8859-1] Sat Feb  7 09:43:14 2009
> @@ -289,7 +289,7 @@
>          *lpValue = ptr;
>      }
>  
> -done:;
> +done:
>      if (dwError != ERROR_SUCCESS)
>      {
>          HeapFree(GetProcessHeap(), 0, ptr);
>
> Modified: trunk/reactos/base/system/services/rpcserver.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcserver.c?rev=39459&r1=39458&r2=39459&view=diff
> ==============================================================================
> --- trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] (original)
> +++ trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] Sat Feb  7 09:43:14 2009
> @@ -4012,33 +4012,36 @@
>  
>      if (InfoW.dwInfoLevel == SERVICE_CONFIG_DESCRIPTION)
>      {
> -        LPSERVICE_DESCRIPTIONW lpServiceDesriptonW;
> -        LPSERVICE_DESCRIPTIONA lpServiceDesriptonA;
> -
> -        lpServiceDesriptonA = Info.psd;
> -
> -        if (lpServiceDesriptonA &&
> -            lpServiceDesriptonA->lpDescription)
> -        {
> -            dwLength = (strlen(lpServiceDesriptonA->lpDescription) + 1) * sizeof(WCHAR);
> -
> -            lpServiceDesriptonW = HeapAlloc(GetProcessHeap(),
> +        LPSERVICE_DESCRIPTIONW lpServiceDescriptonW;
> +        LPSERVICE_DESCRIPTIONA lpServiceDescriptonA;
> +
> +        lpServiceDescriptonA = Info.psd;
> +
> +        ///if (lpServiceDescriptonA &&
> +        ///lpServiceDescriptonA->lpDescription)
> +        ///{
> +            dwLength = (strlen(Info.lpDescription) + 1) * sizeof(WCHAR);
> +
> +            lpServiceDescriptonW = HeapAlloc(GetProcessHeap(),
>                                              0,
>                                              dwLength + sizeof(SERVICE_DESCRIPTIONW));
> -            if (!lpServiceDesriptonW)
> +            if (!lpServiceDescriptonW)
>              {
>                  return ERROR_NOT_ENOUGH_MEMORY;
>              }
>  
> +            lpServiceDescriptonW->lpDescription = (LPWSTR)(lpServiceDescriptonW + 1);
> +
>              MultiByteToWideChar(CP_ACP,
>                                  0,
> -                                lpServiceDesriptonA->lpDescription,
> +                                Info.lpDescription,
>                                  -1,
> -                                lpServiceDesriptonW->lpDescription,
> +                                lpServiceDescriptonW->lpDescription,
>                                  dwLength);
>  
> -            ptr = lpServiceDesriptonW;
> -        }
> +            ptr = lpServiceDescriptonW;
> +            InfoW.psd = lpServiceDescriptonW;
> +        ///}
>      }
>      else if (Info.dwInfoLevel == SERVICE_CONFIG_FAILURE_ACTIONS)
>      {
> @@ -4162,12 +4165,13 @@
>      {
>          LPSERVICE_DESCRIPTIONW lpServiceDescription;
>  
> -        lpServiceDescription = (LPSERVICE_DESCRIPTIONW)&Info;
> -        lpServiceDescription->lpDescription = (LPWSTR)(&Info + sizeof(LPSERVICE_DESCRIPTIONW));
> +        lpServiceDescription = (LPSERVICE_DESCRIPTIONW)Info.psd;
> +        lpServiceDescription->lpDescription = (LPWSTR)((ULONG_PTR)lpServiceDescription + sizeof(LPSERVICE_DESCRIPTIONW));
>  
>          if (lpServiceDescription != NULL &&
>              lpServiceDescription->lpDescription != NULL)
>          {
> +            DPRINT1("Setting value %S\n", lpServiceDescription->lpDescription);
>              RegSetValueExW(hServiceKey,
>                             L"Description",
>                             0,
> @@ -4212,7 +4216,7 @@
>      LPWSTR lpDescriptionW = NULL;
>      LPSTR lpDescription = NULL;
>  
> -    DPRINT("RQueryServiceConfig2W() called\n");
> +    DPRINT1("RQueryServiceConfig2A() called hService %p dwInfoLevel %u, lpBuffer %p cbBufSize %u pcbBytesNeeded %p\n",hService, dwInfoLevel, lpBuffer, cbBufSize, pcbBytesNeeded);
>  
>      if (!lpBuffer)
>          return ERROR_INVALID_ADDRESS;
> @@ -4261,7 +4265,7 @@
>                                  &lpDescriptionW);
>          if (dwError == ERROR_SUCCESS)
>          {
> -            *pcbBytesNeeded += ((wcslen(lpDescriptionW) + 1));
> +            *pcbBytesNeeded += ((wcslen(lpDescriptionW) + 1) * sizeof(WCHAR));
>          }
>  
>          if (cbBufSize >= *pcbBytesNeeded)
>
>
>   



More information about the Ros-dev mailing list