#define REG_MAX_NAME_SIZE 256
#define REG_MAX_DATA_SIZE 2048
-/* FIXME: should go into msvcrt.h header? */
-#define offsetof(s,m) (size_t)&(((s*)NULL)->m)
-
/* GLOBALS ******************************************************************/
static RTL_CRITICAL_SECTION HandleTableCS;
/* FUNCTIONS ****************************************************************/
/* check if value type needs string conversion (Ansi<->Unicode) */
-inline static int is_string( DWORD type )
+__inline static int is_string( DWORD type )
{
return (type == REG_SZ) || (type == REG_EXPAND_SZ) || (type == REG_MULTI_SZ);
}
/* open the subkey */
Status2 = NtOpenKey(&newDelKeys->KeyHandle,
- DELETE | KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE,
+ DELETE | KEY_ENUMERATE_SUB_KEYS,
&ObjectAttributes);
if (!NT_SUCCESS(Status2))
{
Status2 = STATUS_INSUFFICIENT_RESOURCES;
}
}
+ else if (Status2 == STATUS_NO_MORE_ENTRIES)
+ {
+ /* in some race conditions where another thread would delete
+ the same tree at the same time, newDelKeys could actually
+ be != NULL! */
+ if (newDelKeys != NULL)
+ {
+ RtlFreeHeap(ProcessHeap,
+ 0,
+ newDelKeys);
+ }
+ break;
+ }
SubKeyFailure:
- ASSERT(newDelKeys != NULL);
- RtlFreeHeap(ProcessHeap,
- 0,
- newDelKeys);
+ /* newDelKeys can be NULL here when NtEnumerateKey returned an
+ error other than STATUS_BUFFER_TOO_SMALL or STATUS_BUFFER_OVERFLOW! */
+ if (newDelKeys != NULL)
+ {
+ RtlFreeHeap(ProcessHeap,
+ 0,
+ newDelKeys);
+ }
SubKeyFailureNoFree:
/* don't break, let's try to delete as many keys as possible */
- if (Status2 != STATUS_NO_MORE_ENTRIES && NT_SUCCESS(Status))
+ if (NT_SUCCESS(Status))
{
Status = Status2;
}
}
else
Status = STATUS_INSUFFICIENT_RESOURCES;
-
+
return Status;
}
NULL);
Status = NtOpenKey(&SubKeyHandle,
- DELETE | KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE,
+ DELETE | KEY_ENUMERATE_SUB_KEYS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DWORD total_size;
char buffer[256], *buf_ptr = buffer;
KEY_VALUE_FULL_INFORMATION *info = (KEY_VALUE_FULL_INFORMATION *)buffer;
- static const int info_size = offsetof( KEY_VALUE_FULL_INFORMATION, Name );
+ static const int info_size = FIELD_OFFSET( KEY_VALUE_FULL_INFORMATION, Name );
//TRACE("(%p,%ld,%p,%p,%p,%p,%p,%p)\n",
// hkey, index, value, val_count, reserved, type, data, count );
DWORD total_size;
char buffer[256], *buf_ptr = buffer;
KEY_VALUE_FULL_INFORMATION *info = (KEY_VALUE_FULL_INFORMATION *)buffer;
- static const int info_size = offsetof( KEY_VALUE_FULL_INFORMATION, Name );
+ static const int info_size = FIELD_OFFSET( KEY_VALUE_FULL_INFORMATION, Name );
//TRACE("(%p,%ld,%p,%p,%p,%p,%p,%p)\n",
// hkey, index, value, val_count, reserved, type, data, count );
TRACE("MapDefaultKey() failed (Status %lx)\n", Status);
return RtlNtStatusToDosError (Status);
}
-
+#ifndef __REACTOS__
Status = NtQuerySecurityObject(KeyHandle,
SecurityInformation,
pSecurityDescriptor,
*lpcbSecurityDescriptor,
lpcbSecurityDescriptor);
+#endif
ClosePredefKey(KeyHandle);
return RtlNtStatusToDosError (Status);
}
- if (!RtlDosPathNameToNtPathName_U ((LPWSTR)lpFile,
+ if (!RtlDosPathNameToNtPathName_U (lpFile,
&FileName,
NULL,
NULL))
{
*lpcbMaxValueLen = FullInfo->MaxValueDataLen;
}
-
+#ifndef __REACTOS__
if (lpcbSecurityDescriptor != NULL)
{
Status = NtQuerySecurityObject(KeyHandle,
goto Cleanup;
}
}
+#endif
if (lpftLastWriteTime != NULL)
{
}
/* Convert new file name */
- if (!RtlDosPathNameToNtPathName_U ((LPWSTR)lpNewFile,
+ if (!RtlDosPathNameToNtPathName_U (lpNewFile,
&NewFileName,
NULL,
NULL))
NULL);
/* Convert old file name */
- if (!RtlDosPathNameToNtPathName_U ((LPWSTR)lpOldFile,
+ if (!RtlDosPathNameToNtPathName_U (lpOldFile,
&OldFileName,
NULL,
NULL))
return RtlNtStatusToDosError (Status);
}
- if (!RtlDosPathNameToNtPathName_U ((LPWSTR)lpFile,
+ if (!RtlDosPathNameToNtPathName_U (lpFile,
&FileName,
NULL,
NULL))
return RtlNtStatusToDosError (Status);
}
- if (!RtlDosPathNameToNtPathName_U ((PWSTR)lpFile,
+ if (!RtlDosPathNameToNtPathName_U (lpFile,
&FileName,
NULL,
NULL))