diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c index 108b7a2d775..b338634f0b5 100644 --- a/dlls/advapi32/service.c +++ b/dlls/advapi32/service.c @@ -155,6 +155,43 @@ static void init_service_handle( struct sc_handle* handle, handle->u.service.sc_manager = sc_manager; } +static inline LPWSTR SERV_dup( LPCSTR str ) +{ + UINT len; + LPWSTR wstr; + + if( !str ) + return NULL; + len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); + wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, str, -1, wstr, len ); + return wstr; +} + +static inline LPWSTR SERV_dupmulti( LPCSTR str ) +{ + UINT len = 0, n = 0; + LPWSTR wstr; + + if( !str ) + return NULL; + do { + len += MultiByteToWideChar( CP_ACP, 0, &str[n], -1, NULL, 0 ); + n += (strlen( &str[n] ) + 1); + } while (str[n]); + len++; + n++; + + wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, str, n, wstr, len ); + return wstr; +} + +static inline VOID SERV_free( LPWSTR wstr ) +{ + HeapFree( GetProcessHeap(), 0, wstr ); +} + /****************************************************************************** * EnumServicesStatusA [ADVAPI32.@] */ @@ -760,43 +797,6 @@ error: } -static inline LPWSTR SERV_dup( LPCSTR str ) -{ - UINT len; - LPWSTR wstr; - - if( !str ) - return NULL; - len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); - wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) ); - MultiByteToWideChar( CP_ACP, 0, str, -1, wstr, len ); - return wstr; -} - -static inline LPWSTR SERV_dupmulti( LPCSTR str ) -{ - UINT len = 0, n = 0; - LPWSTR wstr; - - if( !str ) - return NULL; - do { - len += MultiByteToWideChar( CP_ACP, 0, &str[n], -1, NULL, 0 ); - n += (strlen( &str[n] ) + 1); - } while (str[n]); - len++; - n++; - - wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) ); - MultiByteToWideChar( CP_ACP, 0, str, n, wstr, len ); - return wstr; -} - -static inline VOID SERV_free( LPWSTR wstr ) -{ - HeapFree( GetProcessHeap(), 0, wstr ); -} - /****************************************************************************** * CreateServiceA [ADVAPI32.@] */