mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
minor string initialization optimizations
svn path=/trunk/; revision=17983
This commit is contained in:
parent
ceb2e22d5f
commit
c87bac8d51
1 changed files with 25 additions and 50 deletions
|
@ -405,20 +405,15 @@ RegCopyTreeA(IN HKEY hKeySrc,
|
||||||
IN LPCSTR lpSubKey OPTIONAL,
|
IN LPCSTR lpSubKey OPTIONAL,
|
||||||
IN HKEY hKeyDest)
|
IN HKEY hKeyDest)
|
||||||
{
|
{
|
||||||
UNICODE_STRING SubKeyName;
|
UNICODE_STRING SubKeyName = {0};
|
||||||
LONG Ret;
|
LONG Ret;
|
||||||
|
|
||||||
if (lpSubKey != NULL)
|
if (lpSubKey != NULL &&
|
||||||
|
!RtlCreateUnicodeStringFromAsciiz(&SubKeyName,
|
||||||
|
(LPSTR)lpSubKey))
|
||||||
{
|
{
|
||||||
if (!RtlCreateUnicodeStringFromAsciiz(&SubKeyName,
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
(LPSTR)lpSubKey))
|
|
||||||
{
|
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
RtlInitUnicodeString(&SubKeyName,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
Ret = RegCopyTreeW(hKeySrc,
|
Ret = RegCopyTreeW(hKeySrc,
|
||||||
SubKeyName.Buffer,
|
SubKeyName.Buffer,
|
||||||
|
@ -440,20 +435,15 @@ RegConnectRegistryA (IN LPCSTR lpMachineName,
|
||||||
IN HKEY hKey,
|
IN HKEY hKey,
|
||||||
OUT PHKEY phkResult)
|
OUT PHKEY phkResult)
|
||||||
{
|
{
|
||||||
UNICODE_STRING MachineName;
|
UNICODE_STRING MachineName = {0};
|
||||||
LONG Ret;
|
LONG Ret;
|
||||||
|
|
||||||
if (lpMachineName != NULL)
|
if (lpMachineName != NULL &&
|
||||||
|
!RtlCreateUnicodeStringFromAsciiz(&MachineName,
|
||||||
|
(LPSTR)lpMachineName))
|
||||||
{
|
{
|
||||||
if (!RtlCreateUnicodeStringFromAsciiz(&MachineName,
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
(LPSTR)lpMachineName))
|
|
||||||
{
|
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
RtlInitUnicodeString(&MachineName,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
Ret = RegConnectRegistryW(MachineName.Buffer,
|
Ret = RegConnectRegistryW(MachineName.Buffer,
|
||||||
hKey,
|
hKey,
|
||||||
|
@ -951,33 +941,23 @@ RegDeleteKeyValueA(IN HKEY hKey,
|
||||||
IN LPCSTR lpSubKey OPTIONAL,
|
IN LPCSTR lpSubKey OPTIONAL,
|
||||||
IN LPCSTR lpValueName OPTIONAL)
|
IN LPCSTR lpValueName OPTIONAL)
|
||||||
{
|
{
|
||||||
UNICODE_STRING SubKey, ValueName;
|
UNICODE_STRING SubKey = {0}, ValueName = {0};
|
||||||
LONG Ret;
|
LONG Ret;
|
||||||
|
|
||||||
if (lpSubKey != NULL)
|
if (lpSubKey != NULL &&
|
||||||
|
!RtlCreateUnicodeStringFromAsciiz(&SubKey,
|
||||||
|
(LPSTR)lpSubKey))
|
||||||
{
|
{
|
||||||
if (!RtlCreateUnicodeStringFromAsciiz(&SubKey,
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
(LPSTR)lpSubKey))
|
|
||||||
{
|
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
RtlInitUnicodeString(&SubKey,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (lpValueName != NULL)
|
if (lpValueName != NULL &&
|
||||||
|
!RtlCreateUnicodeStringFromAsciiz(&ValueName,
|
||||||
|
(LPSTR)lpValueName))
|
||||||
{
|
{
|
||||||
if (!RtlCreateUnicodeStringFromAsciiz(&ValueName,
|
RtlFreeUnicodeString(&SubKey);
|
||||||
(LPSTR)lpValueName))
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
{
|
|
||||||
RtlFreeUnicodeString(&SubKey);
|
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
RtlInitUnicodeString(&ValueName,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
Ret = RegDeleteKeyValueW(hKey,
|
Ret = RegDeleteKeyValueW(hKey,
|
||||||
SubKey.Buffer,
|
SubKey.Buffer,
|
||||||
|
@ -1261,20 +1241,15 @@ LONG STDCALL
|
||||||
RegDeleteTreeA(IN HKEY hKey,
|
RegDeleteTreeA(IN HKEY hKey,
|
||||||
IN LPCSTR lpSubKey OPTIONAL)
|
IN LPCSTR lpSubKey OPTIONAL)
|
||||||
{
|
{
|
||||||
UNICODE_STRING SubKeyName;
|
UNICODE_STRING SubKeyName = {0};
|
||||||
LONG Ret;
|
LONG Ret;
|
||||||
|
|
||||||
if (lpSubKey != NULL)
|
if (lpSubKey != NULL &&
|
||||||
|
!RtlCreateUnicodeStringFromAsciiz(&SubKeyName,
|
||||||
|
(LPSTR)lpSubKey))
|
||||||
{
|
{
|
||||||
if (!RtlCreateUnicodeStringFromAsciiz(&SubKeyName,
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
(LPSTR)lpSubKey))
|
|
||||||
{
|
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
RtlInitUnicodeString(&SubKeyName,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
Ret = RegDeleteTreeW(hKey,
|
Ret = RegDeleteTreeW(hKey,
|
||||||
SubKeyName.Buffer);
|
SubKeyName.Buffer);
|
||||||
|
|
Loading…
Reference in a new issue