[ADVAPI32][USER32][ROSSYM_NEW]

- Fix misuse of RtlCreateUnicodeStringFromAsciiz

svn path=/trunk/; revision=56877
This commit is contained in:
Thomas Faber 2012-07-12 19:48:30 +00:00
parent 42e6e0b684
commit bdc9f3ec76
8 changed files with 32 additions and 65 deletions

View file

@ -30,13 +30,11 @@ DecryptFileA(LPCSTR lpFileName,
DWORD dwReserved)
{
UNICODE_STRING FileName;
NTSTATUS Status;
BOOL ret;
Status = RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName);
if (!NT_SUCCESS(Status))
if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName))
{
SetLastError(RtlNtStatusToDosError(Status));
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
@ -67,13 +65,11 @@ BOOL WINAPI
EncryptFileA(LPCSTR lpFileName)
{
UNICODE_STRING FileName;
NTSTATUS Status;
BOOL ret;
Status = RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName);
if (!NT_SUCCESS(Status))
if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName))
{
SetLastError(RtlNtStatusToDosError(Status));
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
@ -117,17 +113,15 @@ FileEncryptionStatusA(LPCSTR lpFileName,
LPDWORD lpStatus)
{
UNICODE_STRING FileName;
NTSTATUS Status;
BOOL ret = FALSE;
TRACE("(%s, %p)\n", lpFileName, lpStatus);
FileName.Buffer = NULL;
Status = RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName);
if (!NT_SUCCESS(Status))
if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName))
{
SetLastError(RtlNtStatusToDosError(Status));
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto cleanup;
}

View file

@ -156,34 +156,27 @@ LogonUserA(LPSTR lpszUsername,
UNICODE_STRING UserName;
UNICODE_STRING Domain;
UNICODE_STRING Password;
NTSTATUS Status;
BOOL ret = FALSE;
UserName.Buffer = NULL;
Domain.Buffer = NULL;
Password.Buffer = NULL;
Status = RtlCreateUnicodeStringFromAsciiz(&UserName,
lpszUsername);
if (!NT_SUCCESS(Status))
if (!RtlCreateUnicodeStringFromAsciiz(&UserName, lpszUsername))
{
SetLastError(RtlNtStatusToDosError(Status));
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto UsernameDone;
}
Status = RtlCreateUnicodeStringFromAsciiz(&Domain,
lpszDomain);
if (!NT_SUCCESS(Status))
if (!RtlCreateUnicodeStringFromAsciiz(&Domain, lpszDomain))
{
SetLastError(RtlNtStatusToDosError(Status));
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto DomainDone;
}
Status = RtlCreateUnicodeStringFromAsciiz(&Password,
lpszPassword);
if (!NT_SUCCESS(Status))
if (!RtlCreateUnicodeStringFromAsciiz(&Password, lpszPassword))
{
SetLastError(RtlNtStatusToDosError(Status));
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto PasswordDone;
}

View file

@ -156,11 +156,9 @@ ObjectCloseAuditAlarmA(LPCSTR SubsystemName,
UNICODE_STRING Name;
NTSTATUS Status;
Status = RtlCreateUnicodeStringFromAsciiz(&Name,
(PCHAR)SubsystemName);
if (!NT_SUCCESS(Status))
if (!RtlCreateUnicodeStringFromAsciiz(&Name, SubsystemName))
{
SetLastError(RtlNtStatusToDosError(Status));
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
@ -216,11 +214,9 @@ ObjectDeleteAuditAlarmA(LPCSTR SubsystemName,
UNICODE_STRING Name;
NTSTATUS Status;
Status = RtlCreateUnicodeStringFromAsciiz(&Name,
(PCHAR)SubsystemName);
if (!NT_SUCCESS(Status))
if (!RtlCreateUnicodeStringFromAsciiz(&Name, SubsystemName))
{
SetLastError(RtlNtStatusToDosError(Status));
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}

View file

@ -207,14 +207,11 @@ GetFileSecurityA(LPCSTR lpFileName,
LPDWORD lpnLengthNeeded)
{
UNICODE_STRING FileName;
NTSTATUS Status;
BOOL bResult;
Status = RtlCreateUnicodeStringFromAsciiz(&FileName,
(LPSTR)lpFileName);
if (!NT_SUCCESS(Status))
if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName))
{
SetLastError(RtlNtStatusToDosError(Status));
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
@ -344,14 +341,11 @@ SetFileSecurityA(LPCSTR lpFileName,
PSECURITY_DESCRIPTOR pSecurityDescriptor)
{
UNICODE_STRING FileName;
NTSTATUS Status;
BOOL bResult;
Status = RtlCreateUnicodeStringFromAsciiz(&FileName,
(LPSTR)lpFileName);
if (!NT_SUCCESS(Status))
if (!RtlCreateUnicodeStringFromAsciiz(&FileName, lpFileName))
{
SetLastError(RtlNtStatusToDosError(Status));
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
@ -1758,14 +1752,11 @@ SetNamedSecurityInfoA(LPSTR pObjectName,
PACL pSacl)
{
UNICODE_STRING ObjectName;
NTSTATUS Status;
DWORD Ret;
Status = RtlCreateUnicodeStringFromAsciiz(&ObjectName,
pObjectName);
if (!NT_SUCCESS(Status))
if (!RtlCreateUnicodeStringFromAsciiz(&ObjectName, pObjectName))
{
return RtlNtStatusToDosError(Status);
return ERROR_NOT_ENOUGH_MEMORY;
}
Ret = SetNamedSecurityInfoW(ObjectName.Buffer,
@ -2260,14 +2251,11 @@ TreeResetNamedSecurityInfoA(LPSTR pObjectName,
#else
INERNAL_FNPROGRESSW_DATA ifnProgressData;
UNICODE_STRING ObjectName;
NTSTATUS Status;
DWORD Ret;
Status = RtlCreateUnicodeStringFromAsciiz(&ObjectName,
pObjectName);
if (!NT_SUCCESS(Status))
if (!RtlCreateUnicodeStringFromAsciiz(&ObjectName, pObjectName))
{
return RtlNtStatusToDosError(Status);
return ERROR_NOT_ENOUGH_MEMORY;
}
ifnProgressData.fnProgress = fnProgress;

View file

@ -111,8 +111,8 @@ RosSymCreateFromFile(PVOID FileContext, PROSSYM_INFO *RosSymInfo)
NTSTATUS Status;
ULONG StringOffset;
Status = RtlCreateUnicodeStringFromAsciiz(&intConv, (PCSZ)SectionHeaders[SectionIndex].Name + 1);
if (!NT_SUCCESS(Status)) goto freeall;
if (!RtlCreateUnicodeStringFromAsciiz(&intConv, (PCSZ)SectionHeaders[SectionIndex].Name + 1))
goto freeall;
Status = RtlUnicodeStringToInteger(&intConv, 10, &StringOffset);
RtlFreeUnicodeString(&intConv);
if (!NT_SUCCESS(Status)) goto freeall;

View file

@ -70,8 +70,8 @@ RosSymCreateFromMem(PVOID ImageStart, ULONG_PTR ImageSize, PROSSYM_INFO *RosSymI
NTSTATUS Status;
ULONG StringOffset;
Status = RtlCreateUnicodeStringFromAsciiz(&intConv, (PCSZ)SectionHeaders[SectionIndex].Name + 1);
if (!NT_SUCCESS(Status)) goto freeall;
if (!RtlCreateUnicodeStringFromAsciiz(&intConv, (PCSZ)SectionHeaders[SectionIndex].Name + 1))
goto freeall;
Status = RtlUnicodeStringToInteger(&intConv, 10, &StringOffset);
RtlFreeUnicodeString(&intConv);
if (!NT_SUCCESS(Status)) goto freeall;

View file

@ -281,16 +281,14 @@ RealSystemParametersInfoA(UINT uiAction,
case SPI_SETDESKWALLPAPER:
{
NTSTATUS Status;
UNICODE_STRING ustrWallpaper;
BOOL Ret;
if (pvParam)
{
Status = RtlCreateUnicodeStringFromAsciiz(&ustrWallpaper, pvParam);
if (!NT_SUCCESS(Status))
if (!RtlCreateUnicodeStringFromAsciiz(&ustrWallpaper, pvParam))
{
ERR("Status = 0x%x\n", Status);
ERR("RtlCreateUnicodeStringFromAsciiz failed\n");
return FALSE;
}
pvParam = &ustrWallpaper;

View file

@ -4635,7 +4635,6 @@ InsertMenuItemA(
UNICODE_STRING MenuText;
BOOL res = FALSE;
BOOL CleanHeap = FALSE;
NTSTATUS Status;
if((lpmii->cbSize == sizeof(MENUITEMINFOA)) ||
(lpmii->cbSize == sizeof(MENUITEMINFOA) - sizeof(HBITMAP)))
@ -4652,10 +4651,9 @@ InsertMenuItemA(
((mi.fMask & MIIM_TYPE) && (MENU_ITEM_TYPE(mi.fType) == MF_STRING)))
&& mi.dwTypeData != NULL)
{
Status = RtlCreateUnicodeStringFromAsciiz(&MenuText, (LPSTR)mi.dwTypeData);
if (!NT_SUCCESS (Status))
if (!RtlCreateUnicodeStringFromAsciiz(&MenuText, (LPSTR)mi.dwTypeData))
{
SetLastError (RtlNtStatusToDosError(Status));
SetLastError (ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
mi.dwTypeData = MenuText.Buffer;