--- trunk/reactos/lib/advapi32/reg/reg.c 2005-05-05 16:05:46 UTC (rev 15005)
+++ trunk/reactos/lib/advapi32/reg/reg.c 2005-05-05 16:15:08 UTC (rev 15006)
@@ -264,7 +264,6 @@
LONG STDCALL
RegCloseKey (HKEY hKey)
{
- LONG ErrorCode;
NTSTATUS Status;
/* don't close null handle or a pseudo handle */
@@ -276,9 +275,7 @@
Status = NtClose (hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -444,7 +441,6 @@
UNICODE_STRING ClassString;
OBJECT_ATTRIBUTES Attributes;
HANDLE ParentKey;
- LONG ErrorCode;
NTSTATUS Status;
DPRINT("RegCreateKeyExA() called\n");
@@ -454,9 +450,7 @@
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
DPRINT("ParentKey %x\n", (ULONG)ParentKey);
@@ -488,9 +482,7 @@
DPRINT("Status %x\n", Status);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -517,7 +509,6 @@
UNICODE_STRING ClassString;
OBJECT_ATTRIBUTES Attributes;
HANDLE ParentKey;
- LONG ErrorCode;
NTSTATUS Status;
DPRINT("RegCreateKeyExW() called\n");
@@ -527,9 +518,7 @@
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError(Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError(Status);
}
DPRINT("ParentKey %x\n", (ULONG)ParentKey);
@@ -551,9 +540,7 @@
DPRINT("Status %x\n", Status);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -618,15 +605,12 @@
HANDLE ParentKey;
HANDLE TargetKey;
NTSTATUS Status;
- LONG ErrorCode;
Status = MapDefaultKey (&ParentKey,
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
RtlCreateUnicodeStringFromAsciiz (&SubKeyName,
@@ -643,18 +627,14 @@
RtlFreeUnicodeString (&SubKeyName);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
Status = NtDeleteKey (TargetKey);
NtClose (TargetKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError(Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError(Status);
}
return ERROR_SUCCESS;
@@ -675,15 +655,12 @@
HANDLE ParentKey;
HANDLE TargetKey;
NTSTATUS Status;
- LONG ErrorCode;
Status = MapDefaultKey (&ParentKey,
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
RtlInitUnicodeString (&SubKeyName,
@@ -698,18 +675,14 @@
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
Status = NtDeleteKey (TargetKey);
NtClose (TargetKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -727,16 +700,13 @@
{
UNICODE_STRING ValueName;
HANDLE KeyHandle;
- LONG ErrorCode;
NTSTATUS Status;
Status = MapDefaultKey (&KeyHandle,
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
RtlCreateUnicodeStringFromAsciiz (&ValueName,
@@ -746,9 +716,7 @@
RtlFreeUnicodeString (&ValueName);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -766,16 +734,13 @@
{
UNICODE_STRING ValueName;
NTSTATUS Status;
- LONG ErrorCode;
HANDLE KeyHandle;
Status = MapDefaultKey (&KeyHandle,
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
RtlInitUnicodeString (&ValueName,
@@ -785,9 +750,7 @@
&ValueName);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -880,16 +843,13 @@
if ((lpClass) && (!lpcbClass))
{
- SetLastError (ERROR_INVALID_PARAMETER);
return ERROR_INVALID_PARAMETER;
}
Status = MapDefaultKey(&KeyHandle, hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
if (*lpcbName > 0)
@@ -923,7 +883,6 @@
KeyInfo = RtlAllocateHeap (ProcessHeap, 0, BufferSize);
if (KeyInfo == NULL)
{
- SetLastError (ERROR_OUTOFMEMORY);
return ERROR_OUTOFMEMORY;
}
@@ -1010,11 +969,6 @@
0,
KeyInfo);
- if (ErrorCode != ERROR_SUCCESS)
- {
- SetLastError(ErrorCode);
- }
-
return ErrorCode;
}
@@ -1052,9 +1006,7 @@
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
if (*lpcbName > 0)
@@ -1089,7 +1041,6 @@
BufferSize);
if (KeyInfo == NULL)
{
- SetLastError (ERROR_OUTOFMEMORY);
return ERROR_OUTOFMEMORY;
}
@@ -1162,11 +1113,6 @@
0,
KeyInfo);
- if (ErrorCode != ERROR_SUCCESS)
- {
- SetLastError(ErrorCode);
- }
-
return ErrorCode;
}
@@ -1194,10 +1140,7 @@
status = MapDefaultKey (&KeyHandle, hKey);
if (!NT_SUCCESS(status))
{
- LONG ErrorCode;
- ErrorCode = RtlNtStatusToDosError (status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (status);
}
total_size = info_size + (MAX_PATH + 1) * sizeof(WCHAR);
@@ -1321,10 +1264,7 @@
status = MapDefaultKey (&KeyHandle, hKey);
if (!NT_SUCCESS(status))
{
- LONG ErrorCode;
- ErrorCode = RtlNtStatusToDosError (status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (status);
}
total_size = info_size + (MAX_PATH + 1) * sizeof(WCHAR);
@@ -1399,7 +1339,6 @@
RegFlushKey(HKEY hKey)
{
HANDLE KeyHandle;
- LONG ErrorCode;
NTSTATUS Status;
if (hKey == HKEY_PERFORMANCE_DATA)
@@ -1411,17 +1350,13 @@
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
Status = NtFlushKey (KeyHandle);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -1440,12 +1375,10 @@
LPDWORD lpcbSecurityDescriptor)
{
HANDLE KeyHandle;
- LONG ErrorCode;
NTSTATUS Status;
if (hKey == HKEY_PERFORMANCE_DATA)
{
- SetLastError(ERROR_INVALID_HANDLE);
return ERROR_INVALID_HANDLE;
}
@@ -1454,9 +1387,7 @@
if (!NT_SUCCESS(Status))
{
DPRINT("MapDefaultKey() failed (Status %lx)\n", Status);
- ErrorCode = RtlNtStatusToDosError(Status);
- SetLastError(ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
Status = NtQuerySecurityObject(KeyHandle,
@@ -1467,9 +1398,7 @@
if (!NT_SUCCESS(Status))
{
DPRINT("NtQuerySecurityObject() failed (Status %lx)\n", Status);
- ErrorCode = RtlNtStatusToDosError(Status);
- SetLastError(ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -1521,12 +1450,10 @@
UNICODE_STRING FileName;
UNICODE_STRING KeyName;
HANDLE KeyHandle;
- LONG ErrorCode;
NTSTATUS Status;
if (hKey == HKEY_PERFORMANCE_DATA)
{
- SetLastError(ERROR_INVALID_HANDLE);
return ERROR_INVALID_HANDLE;
}
@@ -1534,9 +1461,7 @@
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
if (!RtlDosPathNameToNtPathName_U ((LPWSTR)lpFile,
@@ -1544,7 +1469,6 @@
NULL,
NULL))
{
- SetLastError (ERROR_BAD_PATHNAME);
return ERROR_BAD_PATHNAME;
}
@@ -1570,9 +1494,7 @@
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -1720,7 +1642,6 @@
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING SubKeyString;
HANDLE KeyHandle;
- LONG ErrorCode;
NTSTATUS Status;
DPRINT("RegOpenKeyExA hKey 0x%x lpSubKey %s ulOptions 0x%x samDesired 0x%x phkResult %p\n",
@@ -1729,9 +1650,7 @@
Status = MapDefaultKey (&KeyHandle, hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
RtlCreateUnicodeStringFromAsciiz (&SubKeyString, (LPSTR)lpSubKey);
@@ -1745,9 +1664,7 @@
RtlFreeUnicodeString (&SubKeyString);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -1769,7 +1686,6 @@
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING SubKeyString;
HANDLE KeyHandle;
- LONG ErrorCode;
NTSTATUS Status;
DPRINT("RegOpenKeyExW hKey 0x%x lpSubKey %S ulOptions 0x%x samDesired 0x%x phkResult %p\n",
@@ -1778,9 +1694,7 @@
Status = MapDefaultKey (&KeyHandle, hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
if (lpSubKey != NULL)
@@ -1798,9 +1712,7 @@
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -1893,12 +1805,11 @@
ULONG ClassLength = 0;
HANDLE KeyHandle;
NTSTATUS Status;
- LONG ErrorCode = ERROR_SUCCESS;
ULONG Length;
+ LONG ErrorCode = ERROR_SUCCESS;
if ((lpClass) && (!lpcbClass))
{
- SetLastError(ERROR_INVALID_PARAMETER);
return ERROR_INVALID_PARAMETER;
}
@@ -1906,9 +1817,7 @@
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
if (lpClass != NULL)
@@ -1928,7 +1837,6 @@
FullInfoSize);
if (FullInfo == NULL)
{
- SetLastError (ERROR_OUTOFMEMORY);
return ERROR_OUTOFMEMORY;
}
@@ -1957,9 +1865,7 @@
FullInfo);
}
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
DPRINT("SubKeys %d\n", FullInfo->SubKeys);
@@ -2016,9 +1922,7 @@
FullInfo);
}
- ErrorCode = RtlNtStatusToDosError(Status);
- SetLastError(ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
}
@@ -2048,11 +1952,6 @@
FullInfo);
}
- if (ErrorCode != ERROR_SUCCESS)
- {
- SetLastError (ErrorCode);
- }
-
return ErrorCode;
}
@@ -2201,10 +2100,10 @@
PKEY_VALUE_PARTIAL_INFORMATION ValueInfo;
UNICODE_STRING ValueName;
NTSTATUS Status;
- LONG ErrorCode = ERROR_SUCCESS;
ULONG BufferSize;
ULONG ResultSize;
HANDLE KeyHandle;
+ LONG ErrorCode = ERROR_SUCCESS;
ULONG MaxCopy = lpcbData != NULL && lpData != NULL ? *lpcbData : 0;
DPRINT("hKey 0x%X lpValueName %S lpData 0x%X lpcbData %d\n",
@@ -2214,14 +2113,11 @@
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
if (lpData != NULL && lpcbData == NULL)
{
- SetLastError (ERROR_INVALID_PARAMETER);
return ERROR_INVALID_PARAMETER;
}
@@ -2233,7 +2129,6 @@
BufferSize);
if (ValueInfo == NULL)
{
- SetLastError(ERROR_OUTOFMEMORY);
return ERROR_OUTOFMEMORY;
}
@@ -2253,7 +2148,6 @@
else if (!NT_SUCCESS(Status))
{
ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
MaxCopy = 0;
if (lpcbData != NULL)
{
@@ -2332,7 +2226,6 @@
if (lpData != NULL && lpcbData == NULL)
{
- SetLastError(ERROR_INVALID_PARAMETER);
return ERROR_INVALID_PARAMETER;
}
@@ -2345,7 +2238,6 @@
ValueData.MaximumLength);
if (!ValueData.Buffer)
{
- SetLastError(ERROR_OUTOFMEMORY);
return ERROR_OUTOFMEMORY;
}
}
@@ -2441,7 +2333,6 @@
if (lpValue != NULL &&
lpcbValue == NULL)
{
- SetLastError(ERROR_INVALID_PARAMETER);
return ERROR_INVALID_PARAMETER;
}
@@ -2470,7 +2361,6 @@
ValueSize);
if (Value.Buffer == NULL)
{
- SetLastError(ERROR_OUTOFMEMORY);
return ERROR_OUTOFMEMORY;
}
}
@@ -2533,9 +2423,7 @@
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
if (lpSubKey != NULL &&
@@ -2553,9 +2441,7 @@
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
CloseRealKey = TRUE;
}
@@ -2636,7 +2522,6 @@
BOOLEAN CloseRealKey;
HANDLE RealKeyHandle;
HANDLE KeyHandle;
- LONG ErrorCode;
NTSTATUS Status;
if (hKey == HKEY_PERFORMANCE_DATA)
@@ -2648,9 +2533,7 @@
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
/* Open the real key */
@@ -2668,9 +2551,7 @@
&KeyObjectAttributes);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
CloseRealKey = TRUE;
}
@@ -2690,7 +2571,6 @@
{
NtClose (RealKeyHandle);
}
- SetLastError (ERROR_INVALID_PARAMETER);
return ERROR_INVALID_PARAMETER;
}
@@ -2711,7 +2591,6 @@
{
NtClose (RealKeyHandle);
}
- SetLastError (ERROR_INVALID_PARAMETER);
return ERROR_INVALID_PARAMETER;
}
@@ -2735,9 +2614,7 @@
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -2785,7 +2662,6 @@
UNICODE_STRING FileName;
HANDLE FileHandle;
HANDLE KeyHandle;
- LONG ErrorCode;
NTSTATUS Status;
if (hKey == HKEY_PERFORMANCE_DATA)
@@ -2797,9 +2673,7 @@
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
if (!RtlDosPathNameToNtPathName_U ((LPWSTR)lpFile,
@@ -2807,7 +2681,6 @@
NULL,
NULL))
{
- SetLastError (ERROR_INVALID_PARAMETER);
return ERROR_INVALID_PARAMETER;
}
@@ -2826,9 +2699,7 @@
RtlFreeUnicodeString (&FileName);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
Status = NtRestoreKey (KeyHandle,
@@ -2837,9 +2708,7 @@
NtClose (FileHandle);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -2887,15 +2756,12 @@
HANDLE FileHandle;
HANDLE KeyHandle;
NTSTATUS Status;
- LONG ErrorCode;
Status = MapDefaultKey (&KeyHandle,
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
if (!RtlDosPathNameToNtPathName_U ((PWSTR)lpFile,
@@ -2903,7 +2769,6 @@
NULL,
NULL))
{
- SetLastError (ERROR_INVALID_PARAMETER);
return ERROR_INVALID_PARAMETER;
}
@@ -2931,9 +2796,7 @@
RtlFreeUnicodeString (&FileName);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
Status = NtSaveKey (KeyHandle,
@@ -2941,9 +2804,7 @@
NtClose (FileHandle);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -2961,12 +2822,10 @@
PSECURITY_DESCRIPTOR pSecurityDescriptor)
{
HANDLE KeyHandle;
- LONG ErrorCode;
NTSTATUS Status;
if (hKey == HKEY_PERFORMANCE_DATA)
{
- SetLastError(ERROR_INVALID_HANDLE);
return ERROR_INVALID_HANDLE;
}
@@ -2974,9 +2833,7 @@
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
Status = NtSetSecurityObject (KeyHandle,
@@ -2984,9 +2841,7 @@
pSecurityDescriptor);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -3097,15 +2952,12 @@
PUNICODE_STRING pValueName;
HANDLE KeyHandle;
NTSTATUS Status;
- LONG ErrorCode;
Status = MapDefaultKey (&KeyHandle,
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
if (lpValueName != NULL)
@@ -3136,9 +2988,7 @@
(ULONG)cbData);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;
@@ -3211,17 +3061,15 @@
UNICODE_STRING SubKeyString;
HANDLE KeyHandle;
HANDLE RealKey;
- LONG ErrorCode;
BOOL CloseRealKey;
NTSTATUS Status;
+ LONG ErrorCode;
Status = MapDefaultKey (&KeyHandle,
hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
if ((lpSubKey) && (wcslen(lpSubKey) != 0))
@@ -3238,9 +3086,7 @@
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
CloseRealKey = TRUE;
}
@@ -3301,21 +3147,17 @@
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName;
HANDLE KeyHandle;
- DWORD ErrorCode;
NTSTATUS Status;
if (hKey == HKEY_PERFORMANCE_DATA)
{
- SetLastError(ERROR_INVALID_HANDLE);
return ERROR_INVALID_HANDLE;
}
Status = MapDefaultKey (&KeyHandle, hKey);
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
RtlInitUnicodeString (&KeyName,
@@ -3331,9 +3173,7 @@
if (!NT_SUCCESS(Status))
{
- ErrorCode = RtlNtStatusToDosError (Status);
- SetLastError (ErrorCode);
- return ErrorCode;
+ return RtlNtStatusToDosError (Status);
}
return ERROR_SUCCESS;