[PATCH 2/8] advapi32: Replace SERV_dup() with strdupAW()
Micah N Gorrell
mgorrell at codeweavers.com
Tue Sep 10 12:44:36 CDT 2019
The strdupAW() function in advapi32_misc.h behaves exactly the same as
SERV_dup(). Switching calls to strdupAW() will reduce the complexity
when moving the services RPC functions into sechost by allowing moving
the service.c file with few changes.
Signed-off-by: Micah N Gorrell <mgorrell at codeweavers.com>
---
dlls/advapi32/advapi32_misc.h | 1 -
dlls/advapi32/eventlog.c | 12 ++++++------
dlls/advapi32/security.c | 22 +++++++++++-----------
3 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/dlls/advapi32/advapi32_misc.h b/dlls/advapi32/advapi32_misc.h
index 77b56420ba..65bd8aa852 100644
--- a/dlls/advapi32/advapi32_misc.h
+++ b/dlls/advapi32/advapi32_misc.h
@@ -31,7 +31,6 @@ BOOL ADVAPI_GetComputerSid(PSID sid) DECLSPEC_HIDDEN;
BOOL lookup_local_wellknown_name(const LSA_UNICODE_STRING*, PSID, LPDWORD, LPWSTR, LPDWORD, PSID_NAME_USE, BOOL*) DECLSPEC_HIDDEN;
BOOL lookup_local_user_name(const LSA_UNICODE_STRING*, PSID, LPDWORD, LPWSTR, LPDWORD, PSID_NAME_USE, BOOL*) DECLSPEC_HIDDEN;
-WCHAR *SERV_dup(const char *str) DECLSPEC_HIDDEN;
const WCHAR *get_wellknown_privilege_name(const LUID *) DECLSPEC_HIDDEN;
/* memory allocation functions */
diff --git a/dlls/advapi32/eventlog.c b/dlls/advapi32/eventlog.c
index 6f8d26b516..4349408a00 100644
--- a/dlls/advapi32/eventlog.c
+++ b/dlls/advapi32/eventlog.c
@@ -57,7 +57,7 @@ BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
LPWSTR backupW;
BOOL ret;
- backupW = SERV_dup(lpBackupFileName);
+ backupW = strdupAW(lpBackupFileName);
ret = BackupEventLogW(hEventLog, backupW);
heap_free(backupW);
@@ -114,7 +114,7 @@ BOOL WINAPI ClearEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
LPWSTR backupW;
BOOL ret;
- backupW = SERV_dup(lpBackupFileName);
+ backupW = strdupAW(lpBackupFileName);
ret = ClearEventLogW(hEventLog, backupW);
heap_free(backupW);
@@ -430,8 +430,8 @@ HANDLE WINAPI OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName )
LPWSTR uncnameW, filenameW;
HANDLE handle;
- uncnameW = SERV_dup(lpUNCServerName);
- filenameW = SERV_dup(lpFileName);
+ uncnameW = strdupAW(lpUNCServerName);
+ filenameW = strdupAW(lpFileName);
handle = OpenBackupEventLogW(uncnameW, filenameW);
heap_free(uncnameW);
heap_free(filenameW);
@@ -489,8 +489,8 @@ HANDLE WINAPI OpenEventLogA( LPCSTR uncname, LPCSTR source )
LPWSTR uncnameW, sourceW;
HANDLE handle;
- uncnameW = SERV_dup(uncname);
- sourceW = SERV_dup(source);
+ uncnameW = strdupAW(uncname);
+ sourceW = strdupAW(source);
handle = OpenEventLogW(uncnameW, sourceW);
heap_free(uncnameW);
heap_free(sourceW);
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index 74eda93282..326058e2f7 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -1020,7 +1020,7 @@ GetFileSecurityA( LPCSTR lpFileName,
BOOL r;
LPWSTR name;
- name = SERV_dup(lpFileName);
+ name = strdupAW(lpFileName);
r = GetFileSecurityW( name, RequestedInformation, pSecurityDescriptor,
nLength, lpnLengthNeeded );
heap_free( name );
@@ -1049,7 +1049,7 @@ LookupAccountSidA(
DWORD accountSizeW = *accountSize;
DWORD domainSizeW = *domainSize;
- systemW = SERV_dup(system);
+ systemW = strdupAW(system);
if (account)
accountW = heap_alloc( accountSizeW * sizeof(WCHAR) );
if (domain)
@@ -1303,7 +1303,7 @@ BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
BOOL r;
LPWSTR name;
- name = SERV_dup(lpFileName);
+ name = strdupAW(lpFileName);
r = SetFileSecurityW( name, RequestedInformation, pSecurityDescriptor );
heap_free( name );
@@ -2251,7 +2251,7 @@ static DWORD trustee_name_A_to_W(TRUSTEE_FORM form, char *trustee_nameA, WCHAR *
{
case TRUSTEE_IS_NAME:
{
- *ptrustee_nameW = SERV_dup(trustee_nameA);
+ *ptrustee_nameW = strdupAW(trustee_nameA);
return ERROR_SUCCESS;
}
case TRUSTEE_IS_OBJECTS_AND_NAME:
@@ -2266,9 +2266,9 @@ static DWORD trustee_name_A_to_W(TRUSTEE_FORM form, char *trustee_nameA, WCHAR *
objW->ObjectsPresent = objA->ObjectsPresent;
objW->ObjectType = objA->ObjectType;
- objW->ObjectTypeName = SERV_dup(objA->ObjectTypeName);
- objW->InheritedObjectTypeName = SERV_dup(objA->InheritedObjectTypeName);
- objW->ptstrName = SERV_dup(objA->ptstrName);
+ objW->ObjectTypeName = strdupAW(objA->ObjectTypeName);
+ objW->InheritedObjectTypeName = strdupAW(objA->InheritedObjectTypeName);
+ objW->ptstrName = strdupAW(objA->ptstrName);
}
*ptrustee_nameW = (WCHAR *)objW;
@@ -2648,7 +2648,7 @@ DWORD WINAPI SetNamedSecurityInfoA(LPSTR pObjectName,
TRACE("%s %d %d %p %p %p %p\n", debugstr_a(pObjectName), ObjectType,
SecurityInfo, psidOwner, psidGroup, pDacl, pSacl);
- wstr = SERV_dup(pObjectName);
+ wstr = strdupAW(pObjectName);
r = SetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, psidOwner,
psidGroup, pDacl, pSacl );
@@ -3323,7 +3323,7 @@ BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorA(
if(!StringSecurityDescriptor)
return FALSE;
- StringSecurityDescriptorW = SERV_dup(StringSecurityDescriptor);
+ StringSecurityDescriptorW = strdupAW(StringSecurityDescriptor);
ret = ConvertStringSecurityDescriptorToSecurityDescriptorW(StringSecurityDescriptorW,
StringSDRevision, SecurityDescriptor,
SecurityDescriptorSize);
@@ -3833,7 +3833,7 @@ BOOL WINAPI ConvertStringSidToSidA(LPCSTR StringSid, PSID* Sid)
SetLastError(ERROR_INVALID_PARAMETER);
else
{
- WCHAR *wStringSid = SERV_dup(StringSid);
+ WCHAR *wStringSid = strdupAW(StringSid);
bret = ConvertStringSidToSidW(wStringSid, Sid);
heap_free(wStringSid);
}
@@ -4096,7 +4096,7 @@ DWORD WINAPI GetNamedSecurityInfoA(LPSTR pObjectName,
TRACE("%s %d %d %p %p %p %p %p\n", pObjectName, ObjectType, SecurityInfo,
ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor);
- wstr = SERV_dup(pObjectName);
+ wstr = strdupAW(pObjectName);
r = GetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, ppsidOwner,
ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor );
--
2.23.0
More information about the wine-devel
mailing list